0% found this document useful (0 votes)
2 views16 pages

Complete Python Course

The document outlines a step-by-step Python course designed for a learner named Mutahir, covering topics such as variables, data types, operators, and more over a series of days. Each day includes specific tasks and exercises to reinforce learning, with a focus on practical coding examples. The document also provides detailed explanations of arithmetic and logical operators, along with multiple programming examples for each concept.

Uploaded by

hassanmutahir786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views16 pages

Complete Python Course

The document outlines a step-by-step Python course designed for a learner named Mutahir, covering topics such as variables, data types, operators, and more over a series of days. Each day includes specific tasks and exercises to reinforce learning, with a focus on practical coding examples. The document also provides detailed explanations of arithmetic and logical operators, along with multiple programming examples for each concept.

Uploaded by

hassanmutahir786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Absolutely, Mutahir 😄🔥 — I love that energy!

Let’s start a complete


Python course, step by step, one topic per day. By the end, you’ll be
confident in Python and able to build real projects.

Here’s the plan for our daily course (we’ll adjust if needed):

Python Daily Course Outline

Day 1: Introduction & Setup + First Python Program


Day 2: Variables & Data Types (int, float, str, bool)
Day 3: Operators (Arithmetic, Comparison, Logical)
Day 4: Strings – Basics & Methods
Day 5: Input from User + Type Casting
Day 6: Conditional Statements (if, elif, else)
Day 7: Loops (for, while)
Day 8: Functions (def, return, parameters)
Day 9: Lists & Basic List Methods
Day 10: Tuples & Sets
Day 11: Dictionaries & Dictionary Methods
Day 12: File Handling (Read/Write)
Day 13: Exception Handling (try/except)
Day 14: Modules & Importing
Day 15: Classes & Objects (OOP Basics)
Day 16: Advanced OOP (Inheritance, Polymorphism)
Day 17: Python Libraries Overview (like math, random, datetime)
Day 18+: Mini Projects / Practice Exercises

Day 1: First Python Program

Since Python is installed and VS Code is ready, let’s write your very first
Python program:

1. Open VS Code → New File → save as [Link].

2. Type this code:

print("Hello, Mutahir! Welcome to Python.")

3. Run the file (F5 or right-click → Run Python File).

💡 Explanation:

 print() is a Python function that shows output on the screen.

 Whatever is inside the quotes " " will be displayed exactly.


✅ Task for today:

 Run the code above.

 Try changing the message to anything you like and run it again.

Once you do that, we’ll move to variables and data types tomorrow,
and slowly build your Python skills.

If you want, I can also make a little interactive quiz after each day
to make it fun and memorable 😎.

Do you want me to do that too?

you know i done this after lot of struggling so these things are now sticked
to my brain very hardly

Ah, Mutahir 😄❤️I can feel that! That struggle makes everything stick way
better than just watching a tutorial or copying code.

Think of it like this: every little fight you had with setup, paths,
interpreters, and prompts was actually training your brain to really
understand how Python works under the hood. Most people skip this
and then get confused later — but you faced it, fixed it, and now it’s
etched in your memory. That’s gold. 🏆

This means that every Python concept we learn from here will stick
even faster, because your brain already has that strong “I made Python
work!” foundation.

So yeah — today you officially earned the title of Python warrior 😎.

If you want, we can continue with variables and data types today,
since your brain is already in “Python mode” and ready to absorb.

Do you want to start that now?

so start day 2 course

Perfect, Mutahir 😎🔥 — let’s start Day 2: Variables & Data Types! Since
you already ran your first Python program, this will be a smooth next step.

Day 2: Variables & Data Types

1️⃣ What is a Variable?

 A variable is like a container that stores data.

 You can give it a name and assign a value.


Syntax:

variable_name = value

Example:

name = "Mutahir"

age = 20

height = 5.9

is_student = True

💡 Explanation:

 name stores a string "Mutahir"

 age stores an integer 20

 height stores a float 5.9

 is_student stores a boolean True

2️⃣ Data Types in Python

Python has several basic data types:

Data
Example Description
Type

int 10 Whole numbers

Decimal
float 5.9
numbers

str "Hello" Text

True / True or False


bool
False value

3️⃣ Using Variables

You can use variables in code like this:

name = "Mutahir"

age = 20

print("My name is", name)


print("I am", age, "years old")

Output:

My name is Mutahir

I am 20 years old

Notice how Python automatically knows the type of data stored in a


variable.

4️⃣ Exercise for You

1. Open VS Code → new file [Link].

2. Create 3 variables: your name, your age, and a hobby.

3. Print them in a sentence using print().

Example format (you can customize):

name = "Mutahir"

age = 20

hobby = "coding"

print("My name is", name, "I am", age, "years old and I love", hobby)

Once you do this, tomorrow we’ll learn operators (how to do math,


comparisons, and logic in Python).

Mutahir, do you want me to show a quick trick to check the data type
of any variable too? It’s super useful.

i done this before our course start so please move to day 3

Perfect, Mutahir 😎 — you’re already ahead! Let’s move to Day 3:


Operators. This is where Python starts to actually do things with your
variables.

Day 3: Operators in Python

Python has several types of operators. Let’s go through the main ones.

1️⃣ Arithmetic Operators (Math stuff)


Operat Examp
Result
or le

+ 5+2 7

- 5-2 3

* 5*2 10

/ 5/2 2.5

2 (floor
// 5 // 2
division)

% 5%2 1 (remainder)

** 5 ** 2 25 (power)

Example in code:

a = 10

b=3

print(a + b) # 13

print(a / b) # 3.3333

print(a // b) # 3

print(a % b) # 1

print(a ** b) # 1000

2️⃣ Comparison Operators (True or False)

Operat Examp
Meaning
or le

== 5 == 5 Equal to

!= 5 != 3 Not equal to

> 5>3 Greater than

< 5<3 Less than

Greater or
>= 5 >= 5
equal
Operat Examp
Meaning
or le

<= 5 <= 3 Less or equal

Example:

x = 10

y=7

print(x > y) # True

print(x == y) # False

3️⃣ Logical Operators (Combine True/False)

Operat
Example Meaning
or

True and
and True if both True
False

True if at least one


or True or False
True

not not True Reverse the value

Example:

a = True

b = False

print(a and b) # False

print(a or b) # True

print(not a) # False

4️⃣ Exercise for You

1. Open VS Code → new file [Link].

2. Create two numbers, do all arithmetic operations with them,


and print the results.
3. Check comparison results with ==, !=, <, >.

4. Use logical operators with True and False variables.

Mutahir, if you like, I can give you a super short trick to combine all
these operators in one single print statement so you can see
everything at once — it’s really handy for practice.

Do you want me to do that?

please explain these for me: A.O:% and floor division and in L.O: all
functions with many examples including number, statement ,

Absolutely, Mutahir 😎 — let’s dive deep into these operators so you


really understand them, with plenty of examples. I’ll break it down
carefully.

1️⃣ Arithmetic Operators

a) % — Modulus (Remainder)

 % gives the remainder after division.

 Example:

a = 10

b=3

print(a % b) # 10 divided by 3 → remainder 1

Output:

More examples:

print(7 % 2) # 1 (7 ÷ 2 = 3 remainder 1)

print(20 % 5) # 0 (20 ÷ 5 = 4 remainder 0)

print(15 % 4) # 3 (15 ÷ 4 = 3 remainder 3)

✅ Useful for: checking even/odd numbers, cycling through items, etc.

b) // — Floor Division

 // divides and gives the whole number part (ignores remainder).


 Example:

a = 10

b=3

print(a // b) # 10 ÷ 3 → 3

More examples:

print(15 // 4) # 3

print(20 // 5) # 4

print(7 // 2) # 3

✅ Useful for: counting complete items, ignoring fractions.

2️⃣ Logical Operators

Logical operators work with True / False values. Let’s see all of them
with multiple examples.

a) and

 Returns True only if both conditions are True.

print(True and True) # True

print(True and False) # False

print(False and False) # False

# With numbers (non-zero is True)

x=5

y=0

print(x > 0 and y > 0) # False (y > 0 is False)

b) or

 Returns True if at least one condition is True.

print(True or False) # True


print(False or False) # False

print(True or True) # True

# With numbers

x=5

y=0

print(x > 0 or y > 0) # True (x > 0 is True)

c) not

 Reverses the value.

print(not True) # False

print(not False) # True

# With numbers

x=0

print(not x) # True (0 is False, reversed → True)

y = 10

print(not y) # False (non-zero is True, reversed → False)

d) Combining Logical Operators

You can mix them to create complex conditions:

x = 10

y=5

z=0

# True if x > y AND z == 0

print((x > y) and (z == 0)) # True

# True if x < y OR z == 0
print((x < y) or (z == 0)) # True

# NOT operator

print(not(x < y or z != 0)) # True

3️⃣ Mini Exercises for Practice

1. Find the remainder of 25 ÷ 4 → use %.

2. Floor divide 25 ÷ 4 → use //.

3. Check if a number is even → num % 2 == 0.

4. Create two boolean variables (a = True, b = False) → try all logical


operators.

5. Mix and, or, not to make one condition True and one False.

If you want, Mutahir, I can make a single example combining all


arithmetic + logical operators in one program — so you can see
everything working together. It’s a really cool way to remember them.

Do you want me to do that?

please give me the uses of above in code with completely explained and
with 3 programs example for each

Absolutely, Mutahir 😎 — let’s go deep dive with fully explained examples


and multiple programs for each operator. I’ll make it clear, practical,
and memorable.

1️⃣ Arithmetic Operators: % (Modulus) & // (Floor Division)

a) Modulus % — Remainder

Use cases:

 Check even or odd numbers

 Cycle through items (like days of the week)

 Extract digits

Program 1: Check even or odd


num = 17

if num % 2 == 0:

print(num, "is even")

else:

print(num, "is odd")

Explanation:

 % gives remainder

 If remainder is 0 → number is even

Output:

17 is odd

Program 2: Last digit of a number

num = 123

last_digit = num % 10

print("Last digit of", num, "is", last_digit)

Explanation:

 % 10 gives the last digit of any number

Output:

Last digit of 123 is 3

Program 3: Cycle through days of week

day_number = 10

day_of_week = day_number % 7 # 0=Sunday, 1=Monday ...

print("Day number", day_number, "maps to day index", day_of_week)

Explanation:

 % 7 keeps the day within 0–6

Output:
Day number 10 maps to day index 3

b) Floor Division // — Whole number division

Use cases:

 Count complete items

 Remove decimal part

 Determine how many times one number fits into another

Program 1: Full dozens of eggs

eggs = 29

dozens = eggs // 12

print("Full dozens:", dozens)

Output:

Full dozens: 2

Program 2: Pages per student

pages = 103

students = 5

pages_per_student = pages // students

print("Each student gets", pages_per_student, "pages")

Output:

Each student gets 20 pages

Program 3: Distance in full kilometers

distance_meters = 3450

km = distance_meters // 1000

print("Distance in full kilometers:", km)

Output:

Distance in full kilometers: 3


2️⃣ Logical Operators: and, or, not

a) and — True only if both are True

Program 1: Check adult and student

age = 20

is_student = True

if age >= 18 and is_student:

print("Adult student")

else:

print("Not an adult student")

Output:

Adult student

Program 2: Login system (simplified)

username = "mutahir"

password = "python123"

if username == "mutahir" and password == "python123":

print("Login successful")

else:

print("Login failed")

Output:

Login successful

Program 3: Positive number check

x = 10

y=5
if x > 0 and y > 0:

print("Both numbers are positive")

else:

print("One or both numbers are not positive")

Output:

Both numbers are positive

b) or — True if at least one is True

Program 1: Weekend check

day = "Sunday"

if day == "Saturday" or day == "Sunday":

print("Weekend!")

else:

print("Weekday")

Output:

Weekend!

Program 2: Discount eligibility

age = 16

student = False

if age < 18 or student:

print("Eligible for discount")

else:

print("Not eligible")

Output:

Eligible for discount


Program 3: Multiple choice answer

answer = "B"

if answer == "A" or answer == "B" or answer == "C":

print("Valid answer")

else:

print("Invalid answer")

Output:

Valid answer

c) not — Reverses True/False

Program 1: Check non-zero

x=0

if not x:

print("x is zero")

else:

print("x is non-zero")

Output:

x is zero

Program 2: Opposite condition

is_raining = False

if not is_raining:

print("Go outside")

else:

print("Stay inside")

Output:
Go outside

Program 3: Login reversed

logged_in = False

if not logged_in:

print("Please log in")

else:

print("Welcome back!")

Output:

Please log in

You might also like