
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python variable : variable किसी memory location का नाम होता है जिसमें हम data store करते हैं , variable में कोई भी data store करने के लिए हम assign operator ( = ) का use करते हैं।
python में variable को screen पर दिखाने के लिए ‘print’ function का use करते हैं. हम print function में comma का use करके variable को कई तरीके से screen पर दिखा सकते हैं. जैसा कि example में दिखाया गया है।
नीचे example में देखिए
fruit = "apple"
x = 10
print(fruit, x)
#output : apple 10
इस example मे fruit और x variables है जिनमे apple और x मे 10 को assign operator ( = ) की help से data को variables मे assign किया गया है । फिर हमने print( ) Function की help से fruit और x के अंदर के data को screen पर show किया है।
1. variable का नाम alphabet ( a-z, A-Z ) या underscore (_) से शुरू हो सकता है but यह digit ( 0-9 ) से शुरू नहीं होता है, हां हम digit को नाम के बीच में use कर सकते हैं।
2. variable case sensitive होता है मतलब a और A दोनों अलग-अलग variable होंगे.
# Right mathods
fruit = "apple"
Fruit = "mango"
_fruit = "banana"
fruit23 = "grapes"
print( fruit, Fruit, _fruit, fruit23)
# output : apple mango banana grapes
# Wronge mathods
23fruit = "grapes"
# output : Error
3. variable के value (data) को कभी भी update किया जा सकता है, हमने कोई variable x लिया है जिसमें की 10 assign किया गया है, बाद में हम x में 15 assign कर देते हैं, तो यह value update हो जाएगी अब x में data 10 की जगह 15 हो गई है।
fruit = "apple"
fruit = "mango"
print(fruit)
# output : mango
4. python में हम चाहे तो एक ही line में multiple variable को value assign कर सकते हैं, और हम same value को multiple variable में भी assign कर सकते हैं।
example को देखिए और समझाइए.
''' ek hi line me sabhi variable ko
values assign karna'''
A, B, C = 7, 5, 12
print( B, A, C)
# OUTPUT : 5 7 12
''' ek hi line me sabhi variable me
ek hi value assign karna '''
A = B = C = 23
print( A, B, C)
# OUTPUT : 23 23 23
उम्मीद करते है कि आपको python variable अच्छे समझ मे आ गया होगा । अपने learning को continue रखने के लिए next button पर click करे,
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...
Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...
Scikit-learn Tutorial Scikit-learn Hamburger Toggle Menu Edit Template Scikit learn in Hindi What is Scikit-learn in Hindi Scikit learn एक...