We all know, variables are storing values into our system.
Unlike other programming languages we can also declare variables in python.
But, for declare variable we don't need to add prefix ahead of variable like PHP, Ex. : $var = "variable"
In python simple name a variable and assign a value to it.
x = 2 y = 7
We can also declare string by single or double quotes :
x = 'Blogians' y = "Blogians"
We also assign integer, decimal, boolean values in python :
x = 307 y = 30.7 z = True a = False
Unlike other programming languages there are simple rules to declare a variable
- cannot start with a number
- must start with a letter or the underscore character
- only contain alpha numeric characters and underscores
- names are case-sensitive