Python Variable and Assignments
Variable is used to store a piece of value information it carries to where we require to use and store computers memory.
Rules for writing variables in Python
Letters (A-Z, a-z, 0-9 and _ )
Don’t start with number
No spaces on variable name
Special characters on variable name only(_)
CamelCase
snake_case_variable
number3isokFor
>>> number = 2
real = 2.2
world = “world”
print(world)
world
type(world)
>>> a = b = c = 1.6
print(a)
1.6
print(b)
1.6
print(c)
1.6
>>> one, two, three = 1, ‘two’, 3.0
>>> print(one)
1
>>> print(two)
two
>>> print(three)
3.0
Dynamic variable declaration
number = 1
str = 'string'
number = str
print(number)
Output: string
All you need to know about standard and reserved keywords of python programming language, by type a keyword of formmowing command to you know your python version support reserved keywords.
>>>import keyword
>>>keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
These specific keywords are for python don’t use these keyword names as variable name