🔹 Prerequisites for Learning Python
This course is designed for absolute beginners, and no prior programming experience is required. However, familiarity with basic computer operations and mathematics fundamentals can be beneficial.
Required Tools
🖥 Installing Python
- Download and install Python from the official website: python.org
- Verify installation (
python --version
) - Introduction to Integrated Development Environments (IDEs):
- PyCharm (best for beginners and advanced development)
- VS Code (lightweight and highly customizable)
- Jupyter Notebook (ideal for data science and machine learning)
🛠 Essential Tools:
- Package management using
pip
andvenv
- Using Terminal and Command Prompt in Windows, Linux, and macOS
🔹 Chapter 1: Python Fundamentals
✅ Variables and data types (int
, float
, str
, bool
)
✅ Arithmetic operators (+
, -
, *
, /
, **
, %
)
✅ String manipulation and formatting
✅ Lists (list
), Tuples (tuple
), Sets (set
), and Dictionaries (dict
)
✅ Essential list methods (append
, remove
, pop
, sort
)
✅ Conditional statements and loops (if-else
, for
, while
)
Hands-on Exercise:
🔹 Develop a shopping list manager that allows users to add, remove, and sort items.
🔹 Chapter 2: Functions and Error Handling
✅ Defining functions (def
) and return values (return
)
✅ Optional arguments and default values
✅ Recursive functions
✅ Exception handling (try-except-finally
)
Hands-on Exercise:
🔹 Create a calculator with input validation and error handling.
🔹 Chapter 3: Object-Oriented Programming (OOP) in Python
✅ Classes (class
) and objects (object
)
✅ Class methods and the __init__
constructor
✅ Inheritance and Polymorphism
✅ Managing private (__private
) and public (public
) attributes
Project:
🔹 Build a user management system with registration, login, and role-based access (Admin/User).
🔹 Chapter 4: File Handling and Databases
✅ Reading and writing text files (.txt
)
✅ Processing CSV and JSON files
✅ Connecting to SQLite and MySQL databases
✅ Executing SQL queries (SELECT
, INSERT
, UPDATE
, DELETE
)
Project:
🔹 Develop a digital phonebook with add, delete, and search functionalities.
🔹 Chapter 5: Working with Popular Python Libraries
📊 For Data Analysis:
NumPy
– Numerical computing and array handlingPandas
– Data processing and manipulationMatplotlib & Seaborn
– Data visualization
🌐 For Web Development:
Flask
– Lightweight API and web application developmentDjango
– Full-stack web framework for scalable applications
🤖 For AI & Machine Learning:
TensorFlow
andScikit-learn
– Implementing ML algorithms
📷 For Image Processing:
OpenCV
– Image and video processingPillow
– Handling image files
Project:
🔹 Stock price prediction using Pandas and Scikit-learn.
🔹 Chapter 6: Web Development with Python
✅ Introduction to HTML, CSS, and JavaScript with Python
✅ Building web applications using Flask and Django
✅ Creating RESTful APIs with Flask
✅ User authentication and session management
Project:
🔹 Develop a blogging platform with Django, including user authentication, post publishing, and admin management.
🔹 Chapter 7: Task Automation with Python
✅ Sending HTTP requests with requests
✅ Automating email processing and notifications
✅ Web automation using Selenium
Project:
🔹 Web scraper bot to collect and analyze news articles.
🔹 Final Projects and Career Readiness
🔹 Develop an AI-powered chatbot
🔹 Build a movie recommendation system
🔹 Create an e-commerce website using Django
Basic1
Variables and Data Types in Python
In Python, variables are used to store data, and they can hold different types of values. The main data types include:
- Integer (int) → Represents whole numbers
- Float (float) → Represents decimal numbers
- String (str) → Represents text
- Boolean (bool) → Represents
True
orFalse
values
1. Integer (int)
Integers are whole numbers, including positive and negative numbers, without decimals.
✅ Example 1:
age = 25
students = 100
print(age, students)
📌 Output:
25 100
✅ Example 2:
negative_number = -15
sum_numbers = 10 + 5
print(negative_number, sum_numbers)
📌 Output:
-15 15
2. Float (float)
Float numbers include numbers with decimal points.
✅ Example 1:
price = 19.99
temperature = -5.4
print(price, temperature)
📌 Output:
19.99 -5.4
✅ Example 2:
pi = 3.14159
average = (10.5 + 20.3 + 30.1) / 3
print(pi, average)
📌 Output:
3.14159 20.3
3. String (str)
Strings contain text and are enclosed in either ""
or ''
.
✅ Example 1:
name = "Ali"
message = 'Hello, World!'
print(name, message)
📌 Output:
Ali Hello, World!
✅ Example 2:
greeting = "Good morning"
full_message = greeting + ", have a great day!"
print(full_message)
📌 Output:
Good morning, have a great day!
4. Boolean (bool)
Boolean values represent either True
or False
.
✅ Example 1:
is_sunny = True
is_raining = False
print(is_sunny, is_raining)
📌 Output:
True False
✅ Example 2:
a = 10
b = 20
is_greater = a > b
print(is_greater)
📌 Output:
False
🔹 Note: In Python, variable types are determined automatically. However, you can check a variable’s type using the type()
function:
x = 10
y = 3.14
z = "Python"
w = True
print(type(x)) # <class 'int'="">
print(type(y)) # <class 'float'="">
print(type(z)) # <class 'str'="">
print(type(w)) # <class 'bool'="">
✅ Output:
<class 'int'="">
<class 'float'="">
<class 'str'="">
<class 'bool'="">
Complete Guide to Arithmetic Operators in Python
Arithmetic operators in Python are used to perform mathematical operations on numeric values. These operators include addition (+
), subtraction (-
), multiplication (*
), division (/
), exponentiation (**
), and modulus (%
). Below, we explain each operator with relevant examples.
1. Addition Operator (+
)
The +
operator is used to add two numeric values.
Example 1: Adding two integers
a = 10
b = 5
result = a + b
print("Sum result:", result) # Output: 15
Example 2: Adding a floating-point number and an integer
x = 3.5
y = 2
result = x + y
print("Sum result:", result) # Output: 5.5
2. Subtraction Operator (-
)
The -
operator is used to subtract the second number from the first.
Example 1: Subtracting two integers
a = 20
b = 8
result = a - b
print("Subtraction result:", result) # Output: 12
Example 2: Subtracting a floating-point number from an integer
x = 10
y = 2.5
result = x - y
print("Subtraction result:", result) # Output: 7.5
3. Multiplication Operator (*
)
The *
operator is used to multiply two numbers.
Example 1: Multiplying two integers
a = 6
b = 4
result = a * b
print("Multiplication result:", result) # Output: 24
Example 2: Multiplying a floating-point number by an integer
x = 2.5
y = 3
result = x * y
print("Multiplication result:", result) # Output: 7.5
4. Division Operator (/
)
The /
operator is used to divide the first number by the second. This operator always returns a floating-point result.
Example 1: Dividing two integers
a = 10
b = 4
result = a / b
print("Division result:", result) # Output: 2.5
Example 2: Dividing a floating-point number by an integer
x = 9.0
y = 3
result = x / y
print("Division result:", result) # Output: 3.0
5. Exponentiation Operator (**
)
The **
operator is used to calculate the power of a number.
Example 1: Calculating the power of an integer
base = 3
exponent = 4
result = base ** exponent
print("Exponentiation result:", result) # Output: 81 (3 to the power of 4)
Example 2: Calculating the power of a floating-point number
x = 2.5
y = 3
result = x ** y
print("Exponentiation result:", result) # Output: 15.625
6. Modulus Operator (%
)
The %
operator returns the remainder when the first number is divided by the second.
Example 1: Finding the remainder of integer division
a = 10
b = 3
result = a % b
print("Modulus result:", result) # Output: 1
Example 2: Checking if a number is even or odd
num = 15
if num % 2 == 0:
print("The number is even")
else:
print("The number is odd") # Output: The number is odd
Summary
In this guide, we covered arithmetic operators in Python and provided two examples for each. These operators include:
✅ Addition (+
)
✅ Subtraction (-
)
✅ Multiplication (*
)
✅ Division (/
)
✅ Exponentiation (**
)
✅ Modulus (%
)
Let me know if you have any questions! 😊