Code-Memo

Variables

x = 5
y = "Hello, World!"
Variable Naming Rules
my_var = 10
_my_var = 20
MY_VAR = 30
myVar2 = 40


Dynamic Typing

Python is dynamically typed, meaning you don’t need to declare the type of a variable. The type is inferred from the value.

x = 10      # int
x = "text"  # str


Data Types

Numeric Types
Sequence Types
Mapping Type
Set Types
Boolean Type
None Type
Input
try:
    age = int(input("Enter your age: "))
except ValueError:
    print("Invalid input. Please enter a number.")