Important Notice:

Literals , variable and Constants

Literals , variable and Constants

3 views 1 min read

Literals and Constants (लिटरल्स और कॉन्स्टैंट्स) :-

Python में किसी भी Program को लिखने के लिए हमें Data (डेटा) की आवश्यकता होती है। इस Data को Store (संग्रहित) करने, Represent (प्रदर्शित) करने तथा Program में उपयोग करने के लिए मुख्य रूप से Literal (लिटरल), Variable (वैरिएबल) और Constant (कॉन्स्टैंट) का उपयोग किया जाता है।

  • Literal Program में सीधे लिखी गई वास्तविक (Actual) या निश्चित (Fixed) Value होती है।
  • Variable Memory (मेमोरी) में Data Store करने के लिए दिया गया एक नाम (Name) होता है।
  • Constant ऐसा Variable होता है जिसकी Value पूरे Program के दौरान सामान्यतः (Normally) नहीं बदली जाती।

इन तीनों की सहायता से Python Program Data को Store करता है, Process करता है और आवश्यक Output (आउटपुट) प्रदान करता है।

Example (उदाहरण) -

PI = 3.14159
radius = 5

area = PI * radius * radius

print(area)
 
Output-
30
 
Explanation (व्याख्या) -

ऊपर दिए गए Program में तीनों का उपयोग किया गया है।

  • 3.14159 और 5 Literals हैं क्योंकि ये Program में सीधे लिखी गई निश्चित (Fixed) Values हैं।
  • radius एक Variable है क्योंकि इसमें Store की गई Value आवश्यकता अनुसार बदली जा सकती है।
  • PI एक Constant है क्योंकि इसकी Value पूरे Program में समान (Same) रखी जाती है और सामान्यतः बदली नहीं जाती।
English

In Python, every program works with data. To store, represent, and use this data, Python mainly uses Literals, Variables, and Constants.

  • A Literal is the actual fixed value written directly in the program.
  • A Variable is a name given to a memory location that stores data.
  • A Constant is a variable whose value is intended to remain unchanged throughout the program.

These three concepts help Python store, process, and display data efficiently.

Example (उदाहरण) -
PI = 3.14159
radius = 5

area = PI * radius * radius

print(area)
 
Output-
30
Explanation -

In the above program:

  • 3.14159 and 5 are Literals because they are fixed values written directly in the code.
  • radius is a Variable because its value can change.
  • PI is a Constant because its value is intended to remain the same throughout the program.

Related Notes