1. Setting Up Python
Install Python from python.org.
Use an Integrated Development Environment (IDE) like PyCharm, VS Code, or
Jupyter Notebook for coding.
2. Basic Syntax
Printing Output:
python
Copy code
print("Hello, World!")
Comments: Use # for single-line comments and ''' ''' or """ """ for multi-line
comments.
3. Variables and Data Types
Variable Assignment:
python
Copy code
x=5 # Integer
y = 3.14 # Float
name = "Leo" # String
is_active = True # Boolean
Dynamic Typing: Python doesn't require explicit declaration of variable
types.
4. Basic Operations
Arithmetic: +, -, *, /, // (floor division), % (modulus), ** (exponentiation).
python
Copy code
a = 10
, b=3
print(a + b) # Output: 13
print(a // b) # Output: 3
Comparison: ==, !=, <, >, <=, >=.
Logical: and, or, not.
5. Control Flow
If-Else Statements:
python
Copy code
age = 18
if age >= 18:
print("Adult")
else:
print("Minor")
Loops:
o For Loop:
python
Copy code
for i in range(5): # 0 to 4
print(i)
o While Loop:
python
Copy code
count = 0
while count < 5:
print(count)
count += 1
6. Data Structures