सीधे मुख्य सामग्री पर जाएं

Python variable क्या है ( what is python variable in Hindi)

Python के इस tutorial मे आज हमे देखेगे की Python variable क्या है (what is Python variable in hindi) programming में variable बहुत ही महत्वपूर्ण  होता है। बिना variable के हमे programming नही कर सकते है। variable एक word होता है। जिसमे execution के समय value Store रहते हैं।

Introduction (परिचय)

किसी भी data पर operation perform करने के लिए सबसे पहले उसे computer की memory में store करना पडता है। memory मे data को store करने के लिए variable का प्रयोग किया जाता है।

Variable memory मे किसी location का नाम होता memory है यह नाम उस memory location को computer की संपूर्ण memory मे uniquely identity करता है।जब भी हमे data की आवश्यकता होती है तो हम इस नाम के द्वारा memory location से data को access कर सकते हैं।

आसान शब्दो में जब भी हमे कोई variable Create करते है और उसमें कोई data store करते है तो variable computer की memory मे data के अनुसार एक space बना देता है और data को उस space मे store कर देता है। और जब भी हमे data को access करना हो तो हमे variable की help से कर सकते है। दरअसल variable Computer की memory location में store हुए data की location का नाम होता है।


Types (प्रकार)


Local variable- Local variable वह variable होते है जिन्हें एक function के अन्दर Create किया जाता है तथा function के अन्दर इन्हें access किया जा सकता है। इसका scope local होता हैं। 

Ex-

def f(): 

    # local variable 

    s = "I love Geeksforgeeks"

    print(s)   

# Driver code 

f()


Global variable- global variables वह variable होते है जिन्हें function के बाहर create किया जाता तथा इन्हें function के अन्दर व बाहर दोनों जगह use कर सकते है अर्थात इसका scope global होता हैं। 

Ex-

# global variable

x = "awesome"

def myfunc():

  print("Python is " + x)

myfunc()


Creating and Assigning a variable

python एक dynamic type language हैं इसमें 

हम variable create करते समय variable का data type define करने की आवश्यकता नहीं होती है। python interpreter अपने आप ही variables में assigns data के आधार पर उसका data type define कर लेता है

Examples 


Python variable क्या है ,what is Python variable in hindi,python variable

आज हमने क्या सीखा ?


Python में variable का उपयोग विभिन्न तरीकों से किया जाता है। इसकी महत्वपूर्ण विशेषता यह है कि इन्हें allocate करने के लिए data types की आवश्यकता नहीं होती है। इसलिए, पाइथन में वेरिएबल्स को बहुत सरलता से उपयोग किया जा सकता है।


इस ब्लॉग में, हमने Python variable क्या है (what is Python variable in hindi) के बारे में विस्तार से जाना की इसके कितने प्रकार है, इन्हें कैसे उपयोग किए जाते हैं और कैसे उन्हें असाइन किया जाता है ।

अगर आप पाइथन में नए हैं, तो आपके लिए वेरिएबल्स की यह समझना बहुत महत्वपूर्ण है। इससे आपको पाइथन में प्रोग्रामिंग करने में आसानी होगी और आप अपने कोड में वेरिएबल्स का उपयोग करके डेटा को संगठित रूप से संग्रहीत कर सकते हैं


यदि आपको कुछ confusion हो या कोई अन्य जानकारी जाननी हो तो आप comment कर हमसे पूछ सकते है।

धन्यवाद 



टिप्पणियाँ

एक टिप्पणी भेजें

इस ब्लॉग से लोकप्रिय पोस्ट

Python control statements क्या है ( What is Python control statement in hindi )

Python tutorial में आज हम जानगे की Python control statements क्या है ( What is Python control statement in hindi ) किसी भी programming language में Control statement बहुत ही महत्वपूर्ण होता इसके बिना programming नहीं की जा सकती है आइए इस विस्तार में समझते हैं की Python control statements क्या है ( What is Python control statement in hindi )  INTRODUCTION   Program में condition के अनुसार statement को control करने के लिए control statement का उपयोग किया जाता है। इस हमे decision  making statement भी कहते हैं 1) if Statement- if statement में किसी condition को check किया जाता है यदि condition true होती हैं तो if block मे लिखी statement execute हो जाते हैं और यदि condition false है तो if के block में लिख code को ignore कर दिया जाता है। Syntax- if condition:     Statements Example- a = 10 b = 20 if b > a:   print("b is greater than a") Output- b is greater than a 2) if-else- if-else statement भी if की तरह होता है difference बस इतना है की इसम...

Python environment variable क्या है? ( What is Python environment variables in hindi )

दोस्तों Python के tutorial मे आगे बढ़ते हुए आज हमे सीखे की Python environment variable क्या है? ( What is Python environment variables in hindi ) तो चलाइए इस विस्तार में समझते हैं  Introduction   Environment variable एक dynamic object होता है जिसमे editable value होती है इसका use computer मे एक या एक से ज्यादा software करते हैं environment variable का use program को यह जानने में help करता है की file को किस directory मे store किया जाए। temporary file को कहा store किया जाता file को कहाँ से access किया जाए आदि। Different Environment variable  PYTHONPATH- यह PATH के समान ही होता है। यह Interpreter को बताता है की program में import की गयी module file को कहाँ locate करना है। PYTHONPATH कभी-कभी Python installer द्वारा भी प्रस्तुत किया जाता है।  PYTHONSTARTUP-  यह उस file के path को store करता है जो Python Source कोड को initialize करती है। जब भी interpreter start होता है, तब यह execute होता है। यह PYTHONPATH को modify या utilities को लोड करने का command अपने पास रखता...

Python Indentation क्या है ( What is Python Indentation in hindi )

  दोस्तो आज हमे जानने की Python Indentation क्या है ( What is Python Indentation in hindi ) और साथ ही हम यह भी देखें की इसे कैसे Create व उपयोग करते हैं। INTRODUCTION Python में indentation को काफी महत्व दिया गया python में indentation का use function class, loop और control statements के लिए किया जाता है python में curl bracket की जगह indentation का use किया जाता है। Program में एक block बहुत सारे statements का Collection होता है। एक block को विशिष्ट उद्देश्य के लिए बनाया जाता है। आधिकाश programming language जैसे C, C++,Java आदि code के block को defineकरने के लिए curl bracket ({ }) का प्रयोग करते हैं लेकिन Python में code के block को indentation से define किया जाता है। सामान्य रूप से Indentation एक whitespace होता है जिसका use एक block को दूसरे Block से अलग करने के लिए किया जाता है। एक code Block (function, loop) indentation से start और श un-indentation पर end होता है। किसी भी program मे कितने भी indentation हो सकते है यह पूरे तरह programmers पर depend होता है। यह बहुत ही महत्वप...