Home >> Python Tutorial >> Python Variable
Edit Template
Edit Template

Python Variable in Hindi

What is Variable in Python

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 में देखिए

🐍
varible.py
Copy to clipboard
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 होंगे.

🐍
declaration1.py
Copy to clipboard
# 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 हो गई है।

🐍
declaration2.py
Copy to clipboard
fruit = "apple"
fruit = "mango"

print(fruit)

# output : mango

4.  python में हम चाहे तो एक ही line में multiple variable को value assign  कर सकते हैं, और हम same value को multiple variable में भी assign कर सकते हैं।  

example को देखिए और समझाइए.

🐍
declaration3.py
Copy to clipboard
''' 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 करे,

Add a comment...

  • 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
Dunder Methods

Table of Contents All Chapters 1. Dunder Methods 2. Commonly Used Dunder Methods   Python Tutorial Python Introduction Identation &...

Encapsulation

Table of Contents All Chapters 1. Encapsulation 2. Access Modifiers      2.1. Public Members      2.2. Protected Members...

Lambda Function

Table of Contents All Chapters 1. Lambda Function 2. Nestesd Lambda Function 3. Lambda Function with if-else 4. Lanbda with...

Nested Function

Table of Contents All Chapters 1. Nested Function 2. Return Function from Function 3. Higher Order Function 4. Function Recursion...

Context Manager

Table of Contents All Chapters 1. Context Manager 2. with Statement      2.1. __enter__() Method      2.2. __exit__()...

File Pointer

Table of Contents All Chapters 1. File Pointer 2. File Pointer Methods      2.1. tell() Method      2.2....

File Handling

Table of Contents All Chapters 1. File Handling 2. Types of File 3. open() and close() Methods 4. File Modes...

Edit Template
Scroll to Top