Types of Variable Names in Python ?

Types of Variable Names in Python ?

 Camel Case : First letter lowercase, subsequent words capitalized (e.g. myFirstVariable). 
 Pascal Case : Each word starts with an uppercase letter (e.g. MyFirstVariable). 
 Snake Case : Words separated by underscores, all lowercase (e.g. my_first_variable). 


 Multiple Values to Multiple Variables: 
  •  Multiple values can be assigned to multiple variables in one line.

 Program :


 Output :




 Assigning one value to multiple variables: 

 Program: 


Output:




 Unpack Collection: 
  •   Collections like lists can also be unpacked into variables. 

 Program : 


Output :




Global Variables: 
  •  Global variables are defined outside of functions and can be accessed inside functions. 
  •  Use the global keyword to modify a global variable inside a function. 

Program : 



Output :




Local Variables: 
  •  Local variables are defined inside a function and can only be accessed within that function. 

Program: 


Output :


Post a Comment

0 Comments