A variable is a storage area in computer program which holds some values – numbers, text or records.
Python is a dynamically typed i.e., you do not need to specify variable type during declaring.
How to create a Variable
To create a variable just assign it to a value, with a single equal(=) sign.
>>num = 100
- Python variable should be a name so we can find it again. Variable name should not be of reserved name.
- White spaces and signs with special symbols like (+, – etc) not allowed.
- You can use uppercase or lowercase and underscore(_) to have readability of a variable.
- Variable names are case-sensitive in python.
Lists of some Variable types
x = 211 #Int
x = 123L #Long Integer
x = 923.4 #Double Float
x = “Hello World” #String
x = [1,2,3,4,5] #List
x = (1,2,3,4,5) #Tuple
x = open(‘readme.py’) #File