Python Programming Language Fundamentals
Essential Syntax, Data Types, and Control Structures
1. Variables and Data Types
In Python, variables are dynamically typed, meaning you do not need to declare their type explicitly
before using them. The interpreter infers the data type automatically based on the assigned value.
Data Type Example Syntax Description
Integer x = 10 Whole numbers without decimal points.
Float y = 20.5 Real numbers containing a fractional component.
String name = "Developer" Contiguous sequences of characters enclosed in quotes.
Boolean is_active = True Represents one of two logical states: True or False.
2. Control Flow Structure
Unlike many programming languages that use curly braces, Python relies strictly on whitespace
indentation to define structural code blocks.
if x > 5:
print("X is greater than 5")
else:
print("X is small")
3. Loops and Iteration
For loops are typically utilized to iterate over fixed sequences, lists, or ranges of numbers:
for i in range(5):
print("Iteration:", i)