Variables in Python are used to store data values. Unlike other programming languages, Python has no command for declaring a variable - a variable is created the moment you first assign a value to it.
x = 5
y = "Hello, World!"
z = 3.14
Python is dynamically typed, meaning you don't need to declare the type of a variable. The interpreter infers the type based on the value assigned.
Python supports three numeric types:
Strings in Python are surrounded by either single or double quotes:
name = "Python"
message = 'Hello, World!'
Boolean values represent True or False:
is_active = True
has_permission = False
Ordered, mutable collections:
fruits = ["apple", "banana", "cherry"]
Ordered, immutable collections:
coordinates = (10, 20, 30)
Key-value pairs:
person = {"name": "Alice", "age": 30}
Unordered, unique elements:
unique_numbers = {1, 2, 3, 4, 5}