Python Variables and DataTypes
Python Variables and DataTypes
1. What is a Variable?
A variable is a container for storing data values. In Python, variables are created when you assign a value.
Example:
x = 10
name = "Edson"
price = 99.99
Use:
Variables store data that can be reused and manipulated throughout the program.
Example:
_valid = 1
user1 = "Alice"
Invalid:
3. Data Types:
A. Numeric Types:
Example: age = 25
Variables and Data Types in Python
Example: z = 3 + 4j
B. Text Type:
C. Sequence Types:
D. Set Types:
E. Mapping Type:
F. Boolean Type:
G. Binary Types:
Example:
x = 10
int("5") => 5
6. Dynamic Typing:
x=5 # int
7. NoneType:
Example:
x = None