Python Programing Variables in Hindi :
[8:41 AM, 8/20/2024] ЁЭЩ┐ЁЭЩ╕ЁЭЪИЁЭЪДЁЭЪВЁЭЩ╖ ЁЭЪГЁЭЩ╖ЁЭЩ░ЁЭЩ║ЁЭЪБЁЭЩ┤

Python programing language рдореЗ рднреА рдФрд░ programing language(C, C++,Java etc.) рдХреА рддрд░рд╣ variable рд╣реЛрддреЗ рд╣реИ рдЬреЛ рдХрд┐рд╕реА value рдпрд╛ Data рдХреЛ store рдХрд░рддреЗ рд╣реИред Python рдореЗ Variables рдХреЛ different type рд╕реЗ declare рдХрд┐рдпрд╛ рдЬрд╛рддрд╛ рд╣реИ рдЗрд╕рдореЗрдВ рд╣рдореЗ Variables ka data type define рдХрд░рдиреЗ рдХрд┐ рдЬрд░реВрд░рдд рдирд╣реА рд╣реЛрддреА рд╣реИред
Python variable рдХрд╛ example :
1) a=5
Explain : рдЗрд╕ example рдореЗ ' a 'рдПрдХ variable рд╣реИ рдЬреЛ рдХрд┐ 5 value ko store рдХрд░ рд░рд╣рд╛ рд╣реИ рдУрд░ ' = ' рдПрдХ operator рд╣реИ рдЬрд┐рд╕рдХреА help рд╕реЗ рд╣рдо рдХрд┐рд╕реА рднреА variable рдореЗ value assign рдХрд░рддреЗ рд╣реИред рдЗрд╕рдореЗрдВ 5 рдПрдХ integar рд╣реИред
2) b=2.0
Explain : рдЗрд╕ example me b variable рдореЗ 2.0 рдХреЛ store рдХрд┐рдпрд╛ рдЧрдпрд╛ рдЬрд╣рд╛ b рдХрд╛ data type float рд╣реИред Python рдореЗ built in library рд╣реЛрддреА рд╣реИ рдЬреЛ variable рдХрд╛ data type automatic identify рдХрд░ рд▓реЗрддрд╛ рд╣реИред
Type of variable in Python :
1.Local variable
2.Globel variable
1.Local variable :рдРрд╕реЗ variable variable рдЬрд┐рдирдХрд╛ scope рдХрд┐рд╕реА special block рддрдХ рд╣реА рд╣реЛрддрд╛ рд╣реИ рдЙрдиреНрд╣реЗ Local variable рдХрд╣рд╛ рдЬрд╛рддрд╛ рд╣реИред рдЗрди Variables рдХрд╛ use рд╣рдо block рдХреЗ рдмрд╛рд╣рд░ рдирд╣реА рдХрд░ рд╕рдХрддреЗ рд╣реИред
Example :
def my_function():
local_var = 101 # This is a local variable
print(local_var)
my_function() # This will print: 101
Output : 101
2.Globel Variable : рдРрд╕реЗ variable рдЬрд┐рдирдХрд╛ scope рдкреВрд░реЗ program рдореЗ рд╣реЛрддрд╛ рд╣реИ рдпрд╛ рдЬрд┐рди Variables рдХреЛ рд╣рдо рдХрд╣реА рдкрд░ рднреА use рдХрд░ рд╕рдХрддреЗ рд╣реИ Globel variable рдХрд╣рд▓рд╛рддреЗ рд╣реИред
Example :
global_var = 10
def print_global():
print("Global variable:", global_var) # Access the global variable
print_global()
Output : 10
Variable Declaration Rules in Python :
- 1.Variable рдХрд╛ name рд╣рдореЗрд╢рд╛ alphabet рд╕реЗ start рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред
- 2.variable name рдореЗ рдХреЛрдИ special character(@, #,тВ╣ etc. ) рдирд╣реА рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред
- 3.Variable name рдХрд┐рд╕реА number рд╕реЗ start рдирд╣реА рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред
- 4.Variable name рдореЗ (_) underscore рдХрд╛ рдЙрд╕ рдХрд░ рд╕рдХрддреЗ рд╣реИред
- 5.Variable рдХрд╛ name рд╣рдореЗрд╕рд╛ meaning full рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред
- 6.Variable рдХрд╛ name Python рдХреЗ рдХрд┐рд╕реА reserved keyword(int, float, char) рд╕реЗ match рдирд╣реА рд╣реЛрдирд╛ рдЪрд╛рд╣рд┐рдПред