1. Introduction to Python (Beginner Level)
- What is Python?
High-level, interpreted language known for simplicity and readability.
Used in web development, data science, AI, automation, etc.
- Setting Up Python
Install Python from python.org.
Use IDEs like PyCharm, VS Code, or Jupyter Notebooks.
- Basic Syntax
Hello World Example:
print("Hello, World!")
- Comments:
# This is a single-line comment
'''
This is a
multi-line comment
'''
- Variables and Data Types:
name = "Alice" # String
age = 25 # Integer
height = 5.6 # Float
is_student = True # Boolean
fruits = ["apple", "banana", "cherry"] # List
person = {"name": "Bob", "age": 30} # Dictionary
- Operators:
Arithmetic, Comparison, Logical, Assignment, Bitwise
, 2. Control Flow (Conditional Statements & Loops)
- Conditional Statements:
x = 10
if x > 5:
print("x is greater than 5")
elif x == 5:
print("x is 5")
else:
print("x is less than 5")
- Loops:
For Loop:
for i in range(5):
print(i)
While Loop:
count = 0
while count < 3:
print(count)
count += 1
Loop Control Statements: break, continue, pass
3. Functions and Modules
- Functions:
def greet(name):
return f"Hello, {name}!"
print(greet("Alice"))
- Lambda Functions:
square = lambda x: x * x
print(square(4))