Edit Template
Edit Template
Edit Template

Python Variable

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 किया है। 

Some important points for variable declaration

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 करे,

Some important questions in this tutorial

What is Python Variable, variable kya hota hai.

What is the rule of Python Variable declaration, python me variable ko declare karne ke rule kya hai.

Add a comment...

Your email address will not be published. Required fields are marked *

  • All Posts
  • Artificial Intelligence
  • Computer Fundamentals
  • Computer Networks
  • Data Analytics
  • Data Science
  • DBMS
  • Deep Learning
  • Digital Fundamentals
  • DSA with Python
  • Excel
  • Exercise
  • Git & Github
  • Machine Learning
  • Matplotlib
  • Natural Language Processing
  • NumPy
  • Operating System
  • Pandas-s
  • Power BI
  • Python Tutorial
  • Scikit-learn
  • Seaborn
  • SQL & MySQL
Python List

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python String

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python Loops

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Conditional Statements

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python Operators

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Python String...

Python Data Type

Python Tutorial Python Introduction Identation & Comments Python Variable Python Data Type Python Operators Conditional Statements Python Loops Hamburger Toggle...

Scikit-learn

Scikit-learn Tutorial Scikit-learn Hamburger Toggle Menu Edit Template Scikit learn in Hindi What is Scikit-learn in Hindi Scikit learn एक...

Pandas

Pandas Tutorial Pandas Hamburger Toggle Menu Edit Template Pandas in Hindi What is Pandas in Hindi pandas  एक python library...

NumPy

NumPy Tutorial NumPy Hamburger Toggle Menu Edit Template NumPy in Hindi What is NumPy in Hindi matplotlib का use हम...

Edit Template
Scroll to Top