Defining Variables
Beginning Python Programming
Makzan, 2020 April.
Defining Variables
- Basic variable usage
- Common variable types
- Naming variable
- Reserved keywords
Basic variable usage
# Defining variables
a = 1
b = 2
c = a + b
Common variable types
- Int
- Float
- String
- True/False
- List
- Tuple
- Set
- Dictionary
- None
Naming variables
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
Variable names follow the same convention as function names.
Reserved keywords
and as assert break continue
class def del elif else
except False finally for from
global if import in is
lambda None not or nonlocal
pass raise return True try
while with yield
Not reserved, but don’t use it
int str list set ...
# And all type names,
# function names, module names etc.
Defining Variables
- Basic variable usage
- Common variable types
- Naming variable
- Reserved keywords