Python – Variables and Data types:
A variable is the location in the memory to store the values. A variable may hold different types of values like numbers, strings etc. In Python, no need to declare a datatype for a variable.It will understand by the value that is assigned to the variable.
The name of variable or a function that we define can be called as Identifier. An Identifier must obey the below rules.
Identifiers can have letters, digits, underscores.
There is no definite in length.
All identifiers must start with letter or underscore. You cannot use digits.
Identifier should not be a keyword. (which is a reserved word for python)
Examples of value assignment to a variable:
>>>x = 10 # x is Integer >>>y = 10.1 # y is Float >>>z = "Hello" # z is String >>>x,y = y,x # assign x value to y and y value to x >>>a,b,c = 10,20,30 # assign a,b,c values sperated by comma at a time >>>print(x,y,a,b,c) # printing all the values
Python has different types of datatypes as below.
1.Numbers 2.String 3.List 4.Tuple 5.Dictionary 6.Boolean