O Level Python Notes in Hindi (keywords)

Table of Contents
O Level Python Notes in Hindi (keywords)
O Level Python Notes in Hindi (keywords):-आज अपनी इस पोस्ट के माध्यम से हम O Level (NIELIT) computer course के अंतर्गत आने वाले PYTHON पेपर के विषय में विस्तृत से जानकारी हासिल करेंगे। हम आने वाली पोस्ट में पाइथन पेपर को पूरी तरह से Cover करेंगे । इसलिए यदि आप O level की तैयारी कर रहे हैं और पाइथन पेपर को pass करना चाहते हैं तो आपको यहाँ पेपर पास करने के लिए आवश्यक questions with Solution मिल जायेंगे ।
PYTHON NOTES IN HINDI
Key Words
O LEVEL PYTHON NOTES IN HINDI -1
1.〉And :-
(Logical and) Key word in python “and” keyword का use जब दिये दो या दो से अधिक Operands True होते है, तब True Return किया जाता है → 0 =True , 1 = False
truth Table of Python
X Y X AND Y
0 0 0
1 0 1
1 0 1
1 1 1
SOURCE CODE:-
⇒ Print (5 ! = 6 and 5 ==6 )# False
⇒ Print (5 ! =6 and 5 )# True
⇒ Print (5 ! =6 and 5==6 and 4 <6 )# false
Output :- False True False
2.〉 As :-
As Keyword का Use Module को कोई नया या उपनाम (alias) नाम देकर Import किया जाता है ।
Source Code :-
Import keyword as pykey
Print (pykey.kwlist)
Output :-
keywords आ जायेंगे ।
3.〉Assert :-
Python Program में Debugging के लिए “Assert” Keyword का use करते है । → Assert keyword के साथ जब Condition True होता है तब कुछ नहीं आता, और जब Condition False होता है तब ‘Assertion Error occur होता है।
Source Code :-
- Assert 4==4#No Exception
- Assert 4==5# Assertion Error (Exception Occurred)
Output :-
assert 4 == 5 # Assertion Error (Exception occurred Assertion Error)
4.〉 Break :-
Break Key word
Source Code:-
Num s=[ 1,2,3,4 ]
For n in nums :
Print (n)
if(n==4):
break
out put :1234
5.〉Class :-
User द्वारा classes को define करने के लिए ‘class’ keyword का Use किया जाता है.
→ classes में कुछ attributes और कुछ methods होते है ।
→classes “oop” में सबसे महत्त्वपूर्ण हिस्सा है,
TALLY WITH SHORTCUT KEYS NOTES
Source code :-
Class my Class:
Def Func ( ): ( एक स्पेस दे Def लिखने में)
Print (“hello”) (” ” )
my class. func
Output:-
Hello ( )
(ये Print करने का class का तरीका है ।)
O Level Python Notes in Hindi (keywords)
6.〉Continue :-
Continue keyword का use iterate हो रहे कुछ statements को skip करता है,”Continue” का उपयोग iterate न हो रहे Loop को iterate करने ने लिए किया जाता है।
A=0
While (a <10)
if (a==5)
Print (“skipped Value of a is “, a )
a=a+1
Continue
Print (“Value of a is”, a)
a=a+1
Output:-
Value of is 0
Value of a is 1
Value of a is 2
Value of a is 3
Value of a is 4
Skipped value of a is 5
value of a is 6
value of a is 7
value of a is 8
value of a is 9
7.〉Def :-
Def keyword का use User define function बनाने के लिए किया जाता है।
Source Code :-
Def Func (a)
Print (“Value of a is ” a)
Func (5)
Output :-
value of a is 5
8.〉 Del keyword:-
Del keyword का मतलब Delete होता है इसका use list, tuple, dictionary या किसी और Collection से Element को delete करने के लिये किया जाता है।
Source Code :-
List =[ 1,4,3,5,7]
Del List [2]
Output :-
[1,3,5,7]
Del KW के बजाय remove Function का use भी कर सकते है
Source Code :-
List =[1,43,5,7]
list remove (3)
Print (List)
Output:-
[1,4,5,7]
CURRENT GK
O Level Python Notes in Hindi (keywords)
9.〉 Elif :-
Elif keyword का use if और Else keyword क साथ किया जाता है । एक से ज्यादा Conditions को check करने के लिये elif keyword का use किया जाता जाता है ।
Source Code :-
a=1
if(a<10)
Print (“a is less than 10” )
elif
(a>10)
Print (“a is Greater Then 10”)
else
Print (“a is equal to 10”)
output :-
a is greater than 10
10.〉 Else :-
Else keyword का use if , elif के साथ किया जाता है। अगर if या if और elif की Conditions False होता है तो Else का statement execute होता है ।
Source Code :-
a=11
if(a%2==0)
Print (“Number is even “)
else
Print (“Number is odd”)
output :
Number is odd
11.〉Except :-
except keyword का use Exception / error handling के लिए किया जाता है । try class के साथ except को Use किया जाता है। example में try Block में जो भी Exception occur होगा, उसका तुरंत Block execute हो जायेगा।
Source Code:-
Try
a
Except zero Division error
Print(“Divided by Zero error”)
except name -error
Print (a is not fund )
output :-
a is not found
12.〉Nonlocal :-
Nonlocal keyword का use Nestedfun. के लिए किया जाता है। Nonlocal variable Global भी नहीं होते, अगर inner Function में उनको लिया जाता है तो outer Function में उसकी value change नहीं होती है ।
Source code :-
Var=2
def main func ( )
var =5
Def sub func ( )
var 10
Print (“subfunc” var)
sub funce ( )
Print (“mainfunc “var )
main func ( )
Print “Global”, var )
Output:-
sub func 10
main func 5
Global 2
13.〉False :-
False keyword का use Boolean false का वर्णन करता है अगर दी गई conduction या statement गलत होता है तो False return किया जाता है false “0” के बराबर होता है ।
Source code :-
( Print false ==0)
print(4==5)
output :-
true
False
14.〉Finally :-
finally keyword का use ‘try except’ या ‘try block’ के साथ किया जाता है। Exception error हो या न हो finally block except होता है।
Source code:-
Try
a
except Name error
Print (“Name error exception occurred”)
Finally
print (“Always executed “)
output :
Name error exception occurred
always executed
15.〉For :-
For keyword का use looping के लिए किया जाता है। कलेक्शन के elements को iterate करने के लिए “For” Loop का Ues किया जाता है।
Source code :-
list=[“Rakesh “,”Ramesh “, “Suresh”]
For n in list
Print n
Output :-
Rakesh
Ramesh
Suresh
Note:- Keyword List की अधिक जानकारी के लिए आप हमारी Next Post पर Visit करें।
conclusion (निष्कर्ष ):-
आज हमने O Level Python के लिए कुछ बहुत ही महत्त्वपूर्ण जानकारी पढ़ी।। मुझे आशा है कि इस पोस्ट के अध्ययन से आपको o level python preparation में सहायता होगी । यदि आपको मेरे द्वारा दी गई जानकारी helpful लगी हो तो इसे शेयर अवश्य करे ताकि और स्टूडेंट्स को भी O Level Python को सीखने का मौका मिल सके ।
Pingback: O Level Python Notes in Hindi (Tokens) - Computer Notes Online