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 मिल जायेंगे । ये पोस्ट पाइथन कीवर्ड्स की दूसरी पोस्ट है । एक से पंद्रह तक के कीवर्ड्स पढ़ने के लिए दिए गए लिंक पर क्लिक करे।
O LEVEL PYTHON NOTES IN HINDI KEYWORDS -1
PYTHON NOTES IN HINDI
Key Words
O LEVEL PYTHON NOTES IN HINDI -1
16 )From :-
From keyword का use Import KW के साथ किया जाता है, कुछ विशेष प्रकार के function या attribute को import करने के लिए Form का use किया जाता है । अगर सिर्फ Module को import किया जाता है और उसमे से Func 1 ( ) को लेना पड़ता है other wise “Module.func1( ) को लिखना पड़ता है ।
Module. py
Source Code :-
Def func 1 ( ):
Print (“i am in func 1”)
def fun(2):
Print (“i am in func 2”)
output:
Sample.py
source Code:
From Module import func1
Func1( )
output:
I am Func (1)
17〉 If:-
If keyword का use if stat, if Else stat. और if elif stat में किया जाता है।
Source Code:-
var=0
if (var==0):
Print (“var is equal to 0”)
output:
var is equal to 0
18) Import:-
Import keyword Module को current Prog. पर Import करने के लिये किया जाता है। Exp. में math Module को Import किया गया है।
Source Code :-
Import math . sqrt (16)
Output:
4.0
19) In :-
In keyword का use collections (List , tuple String , dictionary ) में element है या नहीं ये check करके boolean value return करता है for loop में भी In keyword का होना अनिवार्य है।
Source Code :-
list =[6,8,4,7,8]
Print (7 in list )# true
Print (10 in list )# false
Output:
True
Fasle
O Level Python Notes in Hindi Keywords
20) Is:-
Is keyword object equality के लिए किया जाता है ये KW 1== operator के थोड़ा -थोड़ा समान होता है, अगर दो object equal होते है तो True Ret. होता है और equal नहीं होते है तो Return होता है।
Source Code :
Print (“one”is “one”)#True
Print (“one” is 1 )# false
Print (“” is “” )# True
Print (“” ==”” # True
Print ( [ ] ) is [ ] ) # false
Print ( [ ] is == [ ] # True
Output:
True
False
True
True
21 ) Lambda Keyword:-
Lambda keyword से anonymous (without Name ) Function को Create किया जाता है। नाम वाले Function में ‘Def’ KW का use किया जाता है, anonymous Function में ‘Def’ के बजाय lambda keyword का use किया जाता है।
Lambda Function के sentimentalist को Parenthesis [( )] close नहीं किया जाता है । anonymous Function होने के कारण इनको किसी variable पर design किया जाता है और उस variable के जरिये call किया जाता है
नीचे दिए गए exp. का मतलब एक ही है
Normal function
Source Code:
Def Func(a,b):
return a*b
Print (Func(5,5) )
Output: 25
Anonymous Function –
Source Code:
Var
=lambda a,b: a*b
Print (var (5,5) )
Output =25
22) None
‘None’ Keyword – Python में None KW का Use किया जाता है लेकिन दूसरे Programming langues में ‘Null’ KW का use किया जाता है, None का मलतब कोई Value नहीं होती है । अगर Function कोई Value return नहीं करता है तो ‘None’ return करता है ।
Source Code:
Print (None==”)
Print (None==0)
Print (None==None)
Print (type (none))
Output: False
False
True
<Class’None type’>
TALLY WITH SHORTCUT KEYS NOTES
23) Not :
‘Not’ (Logical NOT) KW – का use जब दिये गये Operand को True से False या False से true में Convert करता है ।
0=True
1=False
Truth table of ‘and’
X Not X
0 1
1 0
Source Code:
Print (Not(5!=6))# False
Print (Not (5!=5))# True
Output:
False
True
O Level Python Notes in Hindi Keywords
24.) Or :-
‘Or’ (Logical OR ) KW :- जब दिये गये Operands में से एक भी Operand true होता है तब true Return किया जाता है
0=1
1=False
Source Code:-
Print (5!=6 or 5==6)#
Print /5! =6 or (5=55)# True
Print /5! ==6 or 5 >6 or 6<6)# False
Print /5! ==6 or 5 >6 or 5>6 or 6< 6)# False
Output:
True
True
True
False
25.) Pass :
‘Pass’ Keyword ‘ का use loops, Function और Classes रिक्त रखा गया है । ये एक Null Statement / Block होता है । “Pass” का use जब किया जाता है तब ये कुछ नहीं करता है ।
‘Pass’ Statement का Use एक ही Line पर था Separate line पर भी किया जाता है:
Source Code:
Def Func ( ) : Pass
While 4<5:
Pass
Output:
कोई Value नहीं आयेगी क्योकि 4 already 5 से छोटा है ।
26.) Raise KW:
Raise kw का use Exception handling के लिए किया जाता है । Raise KW से Custom Exception / एरर का निर्माण किया जाता है । ज्यादातर Programming language में ‘throw KW का use किया जाता है । लेकिन python में Raise का use किया जाता है ।
Source Code:
a=12
b=10
if a>d
Raise Value error (“a should be smaller than b “
Output:
Trace back (most recent call last ):
raise Value error (“a should be smaller than b”)
Value error: a should be smaller than be
CURRENT GK
27.)Return :
Return’ KW ‘ का use
Function के आखिरी में किया जाता है । Function को अगर कोई Value Return नहीं की जाती है तो Nell/ None return किया जाता है
Source Code:-
Def func (a )
b=a*a
return b
Print (Func (5 ))
Output:25
28.) True Keyword:
True Keyword ये एक Boolean value है : Logical या Comparison Operations में Boolean value (True , False) return किया जाता है, True की value 1 और False को value 0 होती है :
Source Code:
Print ( True ==1)
Print (True ==0)
Print (1==1)
Print ( True + True)
Output:
True
True
True
2
29.) Try Keyword :
Try Keyword का इस्तेमाल Exception handling में किया जाता है, जिस Code में Exception/ error चेक करना है उस Code को Try Block पर लिखा जाता है ।
Source Code:
Try
a
Exception name Error:
Print (“Value of a is not defined” )
Output:
Value is not Defined
30.) While Keyword :
While Keyword का use looping में किया जाता है । जब तक While Condition True होती है तब तक स्टेटमेंट iterate होता रहता है तब loop iteration बंद हो जाता है :
Source Code:
a=0
While a < 10
Print (“Value of a is” a)
a=a+1
Output:
Value of a is 0
Value of a is 1
Value of a is 2
Value of a is 3
Value of a is 4
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
31.) ‘Whit’ Keyword :
File handling के लियें किया जाता है, जब File के लियें ‘With us’ statement का इस्तेमाल किया जाता है तब File को Close करने की जरुरत नहीं पड़ती है-
Source Code:-
File = open (“Text file.txt”, ‘W’)
File Write (“Helloworld”)
File.Colse( )
Textfile.text
Hello world
32.) Yield KW
‘Yield KW का Function के लियें return Statement जैसे किया जाता है । ‘Yield’ Keyword , generator को return करता है । return statement, function के आखिर में Function Terminate करता है । लेकिन ‘Yield’ statement, Function को Suspend करके वहाँ से आगे शुरू होता है , Normal Function जहां पर खत्म होता है वहाँ पर वापस नहीं आता है ।
Source Code:
Def fun<name ( ):
Yield 5
Yield 10
Yield 15
For Y in Func_name ( ):
Print ( y )
Output:
5
10
15
conclusion (निष्कर्ष ):-
आज हमने O Level Python के लिए कुछ बहुत ही महत्त्वपूर्ण जानकारी पढ़ी।। मुझे आशा है कि इस पोस्ट के अध्ययन से आपको o level python preparation में सहायता होगी । यदि आपको मेरे द्वारा दी गई जानकारी helpful लगी हो तो इसे शेयर अवश्य करे ताकि और स्टूडेंट्स को भी O Level Python को सीखने का मौका मिल सके ।