Python Programming Basics
Python is a high-level, interpreted programming language known for its readability
and simplicity. Below are the foundational concepts for beginners.
1. Variables and Data Types
Python is dynamically typed, meaning you do not need to declare variables before
using them.
name = "Alice" # String (Text)
age = 25 # Integer (Whole number)
price = 19.99 # Float (Decimal number)
is_valid = True # Boolean (True/False)
2. Control Flow (If/Else)
Decision making is handled using conditional statements.
if age >= 18:
print("You are an adult.")
else:
print("You are a minor.")
3. Loops
Loops are used to iterate over a sequence (like a list, tuple, dictionary, set, or
string).
# A simple FOR loop
for i in range(3):
print("Iteration:", i) # Outputs 0, 1, 2