🐍 Structure of Learning Python (Beginner → Advanced)
Think of Python learning like building a house 🏠
You can’t start with the roof.
🧱 LEVEL 1: Python Basics (Foundation)
👉 Goal: Understand syntax & basic logic
Topics to Learn
1. Introduction to Python
2. Installing Python & IDE (VS Code / PyCharm)
3. Python syntax & indentation
4. Comments
5. Variables & naming rules
6. Data types
o int, float, string, boolean
7. Type casting
8. Input & Output
Example
name = input("Enter name: ")
print("Hello", name)
✅ Outcome: You can write simple Python programs
🔁 LEVEL 2: Control Flow (Decision Making)
👉 Goal: Make programs think
Topics
1. if, elif, else
2. Nested conditions
3. Logical operators
4. Comparison operators
Example
if marks >= 50:
print("Pass")
else:
print("Fail")
✅ Outcome: You can control program flow
🔄 LEVEL 3: Loops & Iterations
👉 Goal: Avoid repetition
Topics
1. for loop
2. while loop
3. break, continue, pass
4. range()
Example
for i in range(1, 6):
print(i)
✅ Outcome: You can automate repetitive tasks
📦 LEVEL 4: Data Structures (Very Important 🔥)
👉 Goal: Store & manage data efficiently
Topics
1. List
2. Tuple
3. Set
4. Dictionary
5. Indexing & slicing
6. Built-in functions
Example
student = {"name": "Sharvesh", "age": 21}
print(student["name"])
✅ Outcome: You can handle real data
🧱 LEVEL 5: Functions & Modular Programming
👉 Goal: Reuse code
Topics
1. Defining functions
2. Arguments & return
3. Default & keyword arguments
4. Recursion
5. Lambda functions
Example
def add(a, b):
return a + b
✅ Outcome: Cleaner & reusable code
🧱 LEVEL 6: Object-Oriented Programming (OOP)
👉 Goal: Write professional-level code
Topics
1. Class & object
2. Constructor (__init__)
3. Inheritance
4. Polymorphism
5. Encapsulation
6. Abstraction
Example
class Student:
def __init__(self, name):
[Link] = name
✅ Outcome: You can build scalable programs
⚠️ LEVEL 7: Exception Handling & File Handling
👉 Goal: Handle real-world errors
Topics
1. try, except, else, finally
2. Custom exceptions
3. File read/write
4. Working with CSV & JSON
Example
try:
x = int(input())
except ValueError:
print("Invalid input")
✅ Outcome: Stable programs
📚 LEVEL 8: Modules & Packages
👉 Goal: Use Python’s power
Topics
1. import statement
2. Built-in modules
3. Creating custom modules
4. pip & virtual environments
Example
import math
print([Link](16))
🚀 LEVEL 9: Intermediate to Advanced Python
👉 Goal: Become industry-ready
Topics
1. List / dict comprehensions
2. Iterators & generators
3. Decorators
4. Multithreading & multiprocessing
5. Regex
🎯 LEVEL 10: Python + Career Path (Choose One)
4
Choose Your Direction:
1. 🌐 Web Development → Django, Flask
2. 🤖 AI / ML → NumPy, Pandas, TensorFlow
3. 📊 Data Science → Pandas, Matplotlib
4. ⚙️ Automation → Scripts, Selenium
5. 🔐 Cybersecurity → Networking & scripting
🧱 LEVEL 11: Projects (Most Important 🔥)
👉 No projects = no confidence
Beginner Projects
Calculator
Number guessing game
To-do list
Intermediate Projects
File organizer
Web scraper
Chat application
Advanced Projects
Recommendation system
AI chatbot
Full-stack web app
🏁 Final Advice (Real Talk)
Learn step by step
Practice daily
Don’t jump to AI without basics
Build projects early
For you (CSE student 💻), this structure is perfect.
4
🧱 WEEK 1: Python Basics (Days 1–7)
Day 1 – Introduction & Setup
What is Python?
Why Python?
Install Python
Install VS Code
First program
print("Hello, Python")
Day 2 – Variables & Data Types
Variables
int, float, string, boolean
type()
Practice:
name = "Sharvesh"
age = 21
print(type(age))
Day 3 – Input, Output & Type Casting
input()
int(), float(), str()
age = int(input("Enter age: "))
print(age + 5)
Day 4 – Operators
Arithmetic
Relational
Logical
Assignment
Day 5 – Strings
Indexing
Slicing
String methods
f-strings
Day 6 – Control Statements
if
elif
else
Nested if
Day 7 – Practice Day
✔ Mini tasks:
Even / Odd
Grade calculator
Simple login check
🧱 WEEK 2: Loops & Data Structures (Days 8–14)
Day 8 – for Loop
range()
Iteration
Day 9 – while Loop
break
continue
pass
Day 10 – Lists
Creation
Indexing
append, remove, pop
Sorting
Day 11 – Tuples & Sets
Tuple vs List
Set operations
Day 12 – Dictionaries
Key-value pairs
add/update/delete
Loop through dict
Day 13 – Nested Data Structures
List of lists
Dict inside list
Day 14 – Practice + Mini Project
📌 Project:
Student Management (store name, marks, grade)
🧱 WEEK 3: Functions, Files & Errors (Days 15–21)
Day 15 – Functions
def
arguments
return
Day 16 – Advanced Functions
Default arguments
Keyword arguments
Recursion (basic)
Day 17 – Lambda & Built-in Functions
lambda
map, filter, reduce
Day 18 – File Handling
read()
write()
append()
Day 19 – Exception Handling
try
except
finally
Day 20 – Modules & Packages
import
math, random, datetime
pip basics
Day 21 – Practice + Mini Project
📌 Project:
File-based To-Do List
🔵 WEEK 4: OOP + Real Python (Days 22–30)
Day 22 – OOP Basics
Class
Object
Constructor
Day 23 – OOP Concepts
Inheritance
Polymorphism
Encapsulation
Day 24 – Abstraction
abstract class
interfaces idea
Day 25 – Advanced Python
List comprehension
Dict comprehension
Day 26 – Regex & String Validation
Email validation
Phone number check
Day 27 – Python Interview Problems
Reverse string
Palindrome
Fibonacci
Prime number
Day 28 – DSA with Python
Arrays
Strings
Basic recursion
Day 29 – Final Project
📌 Choose ONE:
Expense Tracker
Password Generator
Quiz Application
File Organizer
Day 30 – Revision + Confidence Boost
✔ Revise all concepts
✔ Clean code
✔ Push project to GitHub
✔ Prepare Python intro for interview
🏁 After 30 Days, You Will Be Able To:
✅ Write clean Python code
✅ Solve logic problems
✅ Explain Python confidently
✅ Move to:
Python + DSA
Python + Web
Python + AI
4
🐍 DAY 1 – Python Foundations (IN-DEPTH)
🎯 Day 1 Goal
By the end of today, you should:
Understand what Python is
Know how Python works internally
Set up Python properly
Write and run your first Python program
Understand how Python executes code
1️⃣ What Exactly Is Python? (Deep but Simple)
Python is a high-level, interpreted programming language designed to make programming:
Easy to read
Easy to write
Easy to maintain
Why “High-Level”?
Because Python hides:
Memory management
Hardware-level details
CPU instructions
You focus on logic, not machine stuff.
2️⃣ How Python Works Internally (VERY IMPORTANT)
Python is interpreted, but here’s the real flow 👇
🔁 Python Execution Flow
Python Code (.py)
Bytecode (.pyc)
Python Virtual Machine (PVM)
Output
What does this mean?
Python does NOT compile directly to machine code
It converts code into bytecode
Bytecode runs inside PVM
💡 That’s why Python:
Is slower than C
But runs on any OS (Windows, Linux, Mac)
3️⃣ Installing Python (What Matters, What Doesn’t)
✔ During Installation (IMPORTANT)
When installing Python:
☑ Check “Add Python to PATH”
If you miss this:
python won’t work in terminal
You’ll get errors like command not found
4️⃣ Python Ways to Run Code
Python has 3 ways to run code:
🧱 1. Interactive Mode (Shell)
Open Command Prompt and type:
python
You’ll see:
>>>
Now type:
print("Hello")
✔ Runs immediately
❌ Not for big programs
🧱 2. Script Mode (REAL PROGRAMMING)
Create a file:
[Link]
Write:
print("Hello Python")
Run:
python [Link]
✔ Used in real projects
✔ This is what we’ll mostly use
🧱 3. IDE Mode (VS Code / PyCharm)
Better debugging
Auto suggestions
Clean coding
We’ll assume VS Code.
5️⃣ Your First Python Program (Deep Understanding)
print("Hello, World")
Let’s break it:
Part Meaning
print Built-in function
() Function call
"Hello, World" String (text data)
Why quotes?
Because:
Quotes tell Python: this is text
Without quotes → Python thinks it’s a variable
❌ Wrong:
print(Hello)
✔ Correct:
print("Hello")
6️⃣ Comments in Python
Comments are ignored by Python
Used for:
Explanation
Readability
Single-line comment
# This is a comment
print("Hello")
Multi-line comment (actually strings)
"""
This is a
multi-line comment
"""
7️⃣ Python Is Case-Sensitive ⚠️
print("Hello") # Correct
Print("Hello") # ❌ Error
Python treats:
print
Print
PRINT
as different things.
8️⃣ Indentation (Python’s Superpower)
Python uses indentation instead of braces {}.
Example:
if True:
print("Inside if")
print("Still inside")
❌ Wrong:
if True:
print("Error")
Indentation is NOT optional.
9️⃣ Common Beginner Errors (Know This Early)
❌ Missing Quotes
print(Hello)
❌ Wrong Indentation
if True:
print("Hello")
❌ Wrong File Extension
[Link] ❌
[Link] ✔
🧱 Day 1 Practice (MANDATORY)
Do ALL of these 👇
1️⃣ Print your name
print("Sharvesh")
2️⃣ Print 3 lines of text
print("Python")
print("is")
print("awesome")
3️⃣ Add comments to your code
4️⃣ Try running code in:
Python shell
.py file
🧱 Day 1 Summary (Interview Ready)
Python is a high-level, interpreted, platform-independent programming language that executes code
using a Python Virtual Machine and emphasizes readability and simplicity.
4
🐍 DAY 2 – Variables & Data Types (IN-DEPTH)
🎯 Day 2 Goal
By the end of today, you will:
Clearly understand what variables are
Know how Python stores data
Learn all basic data types
Avoid common beginner mistakes
Write clean, correct programs
1️⃣ What Is a Variable? (Real Meaning)
A variable is a name that refers to a value stored in memory.
Think of it like this 🧱
👉 Variable = label
👉 Value = actual data
age = 21
age → label
2️1️ → value
= → assignment operator
Python reads this as:
“Create a name age that points to the value 2️1️”
2️⃣ How Python Stores Variables (IMPORTANT CONCEPT)
Unlike C / Java:
Python does not store data inside variables
Variables reference objects in memory
Example:
a = 10
b=a
What happens internally:
1️0 ← object in memory
a, b both point here
So:
print(a) # 10
print(b) # 10
💡 This is why Python is called dynamically typed.
3️⃣ Dynamic Typing (Python Superpower)
In Python:
You don’t declare data types
Python decides at runtime
x = 10 # int
x = "Hello" # str
x = 3.14 # float
Same variable, different types ✔
This is NOT possible in C / Java.
4️⃣ Basic Data Types (Core Foundation)
🔹 1. Integer (int)
Whole numbers
age = 21
count = -5
🔹 2. Float (float)
Decimal numbers
price = 99.99
pi = 3.14
🔹 3. String (str)
Text data (inside quotes)
name = "Sharvesh"
city = 'Chennai'
✔ Single quotes or double quotes both work
🔹 4. Boolean (bool)
Only two values:
is_student = True
is_working = False
⚠️ Note:
True and False must start with capital letter
5️⃣ Checking Data Type (type())
x = 10
print(type(x)) # <class 'int'>
y = "Python"
print(type(y)) # <class 'str'>
This is very useful for debugging.
6️⃣ Multiple Variable Assignment
Python allows assigning multiple values in one line:
a, b, c = 10, 20, 30
print(a, b, c)
Swap values easily 😎:
x=5
y = 10
x, y = y, x
7️⃣ Variable Naming Rules (VERY IMPORTANT)
✔ Valid Names
name
total_marks
student1
_price
❌ Invalid Names
1name ❌ starts with number
total-marks ❌ hyphen not allowed
class ❌ keyword
🧱 Rules:
Must start with letter or _
Cannot start with number
No spaces
No keywords
8️⃣ Keywords (Cannot Be Used as Variables)
Examples:
if, else, for, while, True, False, None
Check keywords:
import keyword
print([Link])
9️⃣ Type Casting (Convert One Type to Another)
🔹 int → str
age = 21
print("Age is " + str(age))
🔹 str → int
num = "10"
print(int(num) + 5)
⚠️ Wrong conversion causes error:
int("abc") # ❌ ValueError
🔟 Common Beginner Mistakes (READ CAREFULLY)
❌ Forgetting Quotes
name = Sharvesh # ❌ error
✔ Correct:
name = "Sharvesh"
❌ Using Wrong Boolean Case
True ✔
true ❌
❌ Assuming Variable Has Fixed Type
x = 10
x = "ten" # This is allowed in Python
🧱 Day 2 Practice (DO THIS)
✅ Practice 1
name = "Sharvesh"
age = 21
print(name)
print(age)
✅ Practice 2
a = 10
b = 20
print(a + b)
✅ Practice 3
x = "5"
y=5
print(int(x) + y)
🧱 Day 2 Summary (Interview-Ready)
Variables in Python are references to objects in memory, and Python uses dynamic typing to
determine data types at runtime.
4
🐍 DAY 3 – Input & Output (IN-DEPTH)
🎯 Day 3 Goal
By the end of today, you will:
Understand how Python interacts with users
Master input() and print()
Learn type conversion with user input
Handle common runtime mistakes
Write small real-world programs
1️⃣ Why Input & Output Are Important
Programs are useless if:
They don’t accept data
They don’t show results
Input → Processing → Output
This is the core of programming.
2️⃣ Output in Python (print())
Basic Output
print("Hello Python")
Printing Variables
name = "Sharvesh"
print(name)
3️⃣ Printing Multiple Values
name = "Sharvesh"
age = 21
print(name, age)
Output:
Sharvesh 21
Python automatically adds space.
4️⃣ String Concatenation (Joining Text)
❌ Wrong Way
age = 21
print("Age is " + age) # Error
✔ Correct Way (Type Casting)
print("Age is " + str(age))
5️⃣ f-Strings (BEST & MODERN WAY 🔥)
name = "Sharvesh"
age = 21
print(f"My name is {name} and I am {age} years old")
✔ Clean
✔ Readable
✔ Interview favorite
6️⃣ Input in Python (input())
name = input("Enter your name: ")
print(name)
⚠️ IMPORTANT:
input() always returns a string
Even if user enters:
21
Python stores it as:
"21"
7️⃣ Type Conversion with Input (CRUCIAL)
Example Problem
age = input("Enter age: ")
print(age + 5) # ❌ Error
Solution
age = int(input("Enter age: "))
print(age + 5)
Now Python knows it’s a number.
8️⃣ Common Type Conversions
Conversion Example
str → int int("10")
str → float float("3.14")
int → str str(25)
Conversion Example
float → int int(3️.9) → 3️
9️⃣ Real-World Example (Simple Calculator)
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Sum =", a + b)
print("Difference =", a - b)
print("Product =", a * b)
print("Division =", a / b)
🔟 Runtime Errors (VERY IMPORTANT)
❌ ValueError
age = int(input("Enter age: "))
User enters:
abc
➡️ Program crashes.
We’ll fix this later using exception handling.
❌ TypeError
print("Age is " + 21)
1️⃣1️⃣ Input vs Hardcoded Values
Hardcoded ❌
age = 21
Dynamic Input ✔
age = int(input("Enter age: "))
Dynamic programs = real programs.
🧱 Day 3 Practice (MUST DO)
✅ Practice 1
Ask name & age, then print:
Hello Sharvesh, you are 21 years old
✅ Practice 2
Take two numbers and print their sum.
✅ Practice 3
Take a number and print:
Double
Square
🧱 Day 3 Summary (Interview-Ready)
In Python, input() is used to accept user input as strings, and type casting is required to perform
numerical operations.
4
🐍 DAY 4 – Operators in Python (IN-DEPTH)
🎯 Day 4 Goal
By the end of today, you will:
Understand what operators are
Use all types of Python operators
Build logical expressions
Avoid common operator mistakes
Be ready for if conditions (DAY 5+)
1️⃣ What Is an Operator?
An operator is a symbol that tells Python to perform an operation on values (operands).
Example:
a = 10 + 5
+ → operator
1️⃣0, 5 → operands
2️⃣ Types of Operators in Python
Python mainly has:
1. Arithmetic Operators
2. Relational (Comparison) Operators
3. Logical Operators
4. Assignment Operators
(We’ll do the most important ones today.)
🔢 3️⃣ Arithmetic Operators
Used for mathematical calculations.
Operator Meaning Example
+ Addition 10 + 5 = 15
- Subtraction 10 - 5 = 5
* Multiplication 10 * 5 = 50
/ Division 10 / 5 = 2.0
% Modulus (remainder) 10 % 3 = 1
// Floor division 10 // 3 = 3
** Power 2 ** 3 = 8
Example Code
a = 10
b=3
print(a + b)
print(a % b)
print(a // b)
print(a ** b)
🧱 4️⃣ Modulus Operator (VERY IMPORTANT)
num = 7
print(num % 2)
Output:
👉 Used to check:
Even / Odd
Divisibility
Patterns
Example:
num = 10
print(num % 2️⃣ == 0) # True → even
⚖️ 5 Relational (Comparison) Operators
Used to compare values.
Result is always True or False.
Operator Meaning
> Greater than
< Less than
>= Greater or equal
<= Less or equal
== Equal to
!= Not equal
Example
a = 10
b = 20
print(a > b) # False
print(a == b) # False
print(a != b) # True
⚠️ Common Mistake
a = 10
if a = 1️⃣0: # ❌ WRONG
✔ Correct:
if a == 10:
🔗 6️⃣ Logical Operators (REAL DECISION MAKING)
Used to combine conditions.
Operator Meaning
and Both conditions must be True
or Any one condition True
not Reverse the result
🔹 and Operator
age = 21
print(age > 18 and age < 25) # True
🔹 or Operator
marks = 35
print(marks >= 50 or marks == 35) # True
🔹 not Operator
is_logged_in = False
print(not is_logged_in) # True
🧱 Truth Table (Understand This Once)
AND
A B A and B
TTT
TFF
F TF
F FF
OR
A B A or B
TTT
TFT
F TT
F FF
📝 7️⃣ Assignment Operators
x = 10
x += 5 # x = x + 5
x -= 2 # x = x - 2
Example:
a = 10
a *= 3
print(a) # 30
🔥 8️⃣ Operator Precedence (IMPORTANT)
Python follows BODMAS:
()
**
*, /, //, %
+, -
Example:
result = 10 + 2 * 5
print(result) # 20
Use brackets for clarity:
result = (10 + 2) * 5
print(result) # 60
🧱 Day 4 Practice (DO ALL)
✅ Practice 1
Check if a number is even or odd.
✅ Practice 2
Take two numbers and print:
Greater number
✅ Practice 3
Check if a person is eligible to vote:
age ≥ 18
🧱 Day 4 Summary (Interview-Ready)
Operators in Python are symbols used to perform arithmetic, comparison, and logical
operations, and they form the foundation of decision-making in programs.
4
🐍 DAY 5 – Strings in Python (IN-DEPTH)
🎯 Day 5 Goal
By the end of today, you will:
Fully understand what strings are
Master indexing & slicing
Learn important string methods
Understand immutability
Solve real-world string problems
1️⃣ What Is a String?
A string is a sequence of characters enclosed in quotes.
name = "Sharvesh"
Each character has an index number.
2️⃣ String Indexing (VERY IMPORTANT)
Python uses 0-based indexing.
S h a r v e s h
0 1 2 3 4 5 6 7
Access Single Character
name = "Sharvesh"
print(name[0]) # S
print(name[3]) # r
3️⃣ Negative Indexing
Python also supports negative indexing.
S h a r v e s h
-8 -7 -6 -5 -4 -3 -2 -1
print(name[-1]) # h
print(name[-2]) # s
4️⃣ String Slicing (POWERFUL 🔥)
Syntax:
string[start : end]
✔ start → inclusive
❌ end → exclusive
Examples
name = "Sharvesh"
print(name[0:4]) # Shar
print(name[2:6]) # arve
print(name[:4]) # Shar
print(name[4:]) # vesh
5️⃣ Slicing with Step
print(name[0:8:2]) # Sare
Reverse string:
print(name[::-1]) # hsevrahS
🔥 Interview favorite
6️⃣ String Immutability (CRITICAL CONCEPT)
Strings cannot be changed once created.
❌ Wrong:
name = "Sharvesh"
name[0] = "S"
✔ Correct:
name = "Sharvesh"
name = "S" + name[1:]
7️⃣ Important String Methods
🔹 len()
print(len(name)) # 8
🔹 lower() & upper()
print([Link]())
print([Link]())
🔹 strip()
Removes spaces:
text = " hello "
print([Link]())
🔹 replace()
print([Link]("h", "H"))
🔹 split()
msg = "Python is awesome"
print([Link]())
🔹 join()
words = ["Python", "is", "fun"]
print(" ".join(words))
🔹 find()
print([Link]("v")) # index
8️⃣ Checking String Content
text = "Python123"
print([Link]()) # False
print([Link]()) # False
print([Link]()) # True
9️⃣ Real-World Examples
✅ Email Validation (Basic)
email = input("Enter email: ")
if "@" in email and "." in email:
print("Valid email")
else:
print("Invalid email")
✅ Username Formatting
name = input("Enter name: ")
print([Link]().title())
🔟 Common Mistakes
❌ Index out of range
❌ Trying to modify strings
❌ Forgetting slicing end is exclusive
🧱 Day 5 Practice (DO THIS)
Practice 1
Reverse a string using slicing
Practice 2
Count number of characters in a string
Practice 3
Check if a string is palindrome
🧱 Day 5 Summary (Interview-Ready)
Strings in Python are immutable sequences of characters that support indexing, slicing, and a wide
range of built-in methods for text processing.
4
🐍 DAY 6 – Conditional Statements (if / elif / else) — IN-DEPTH
🎯 Day 6 Goal
By the end of today, you will:
Understand decision making in programs
Master if, elif, else
Write real-life logic programs
Avoid common conditional mistakes
Be fully ready for loops (DAY 7+)
1️⃣ Why Do We Need Conditions?
Programs must decide based on data.
Real life:
If it rains → take umbrella
If marks ≥ 50 → pass
If age ≥ 1️8 → eligible to vote
Same logic in Python.
2️⃣ The if Statement (Base Concept)
Syntax
if condition:
statement
Example
age = 21
if age >= 18:
print("Eligible to vote")
🧱 Important:
Condition must return True or False
Indentation is mandatory
3️⃣ if–else Statement
Used when there are two possible outcomes.
Syntax
if condition:
block1
else:
block2
Example
age = 16
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible")
4️⃣ if–elif–else (Multiple Conditions)
Used when there are more than two cases.
Syntax
if condition1:
block1
elif condition2:
block2
else:
block3
Example (Marks & Grade)
marks = 75
if marks >= 90:
print("Grade A")
elif marks >= 75:
print("Grade B")
elif marks >= 50:
print("Grade C")
else:
print("Fail")
🧱 Python checks top to bottom and stops at first True.
5️⃣ Nested if (if inside if)
Used when a decision depends on another decision.
Example
age = 20
citizen = True
if age >= 18:
if citizen:
print("Eligible to vote")
else:
print("Not a citizen")
else:
print("Underage")
⚠️ Use nesting carefully — readability matters.
6️⃣ Conditions with Logical Operators
Using and
age = 21
has_id = True
if age >= 18 and has_id:
print("Allowed")
Using or
day = "Sunday"
if day == "Saturday" or day == "Sunday":
print("Holiday")
Using not
is_logged_in = False
if not is_logged_in:
print("Please login")
7️⃣ Truthy & Falsy Values (IMPORTANT)
In Python:
0, "", None, False → False
Everything else → True
Example:
name = ""
if name:
print("Name entered")
else:
print("Empty input")
8️⃣ Common Beginner Mistakes 🚫
❌ Using = instead of ==
if age = 18: # ❌
✔ Correct:
if age == 18:
❌ Forgetting Indentation
if age > 18:
print("Eligible") # ❌
❌ Wrong Condition Order
marks = 95
if marks >= 50:
print("Pass")
elif marks >= 90:
print("A Grade") # Never reached
✔ Always check higher conditions first.
9️⃣ Real-World Programs (VERY IMPORTANT)
✅ Even or Odd
num = int(input("Enter number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
✅ Simple Login Check
username = input("Enter username: ")
if username == "admin":
print("Welcome Admin")
else:
print("Access Denied")
✅ Age Category
age = int(input("Enter age: "))
if age < 13:
print("Child")
elif age < 20:
print("Teenager")
else:
print("Adult")
🧱 Day 6 Practice (MANDATORY)
Practice 1
Take a number and check:
o Positive
o Negative
o Zero
Practice 2
Take 3 numbers and print the largest
Practice 3
Electricity bill logic (simple):
o Units < 1️00 → Free
o Units < 3️00 → ₹2️/unit
o Else → ₹5/unit
🧱 Day 6 Summary (Interview-Ready)
Conditional statements in Python (if, elif, else) are used to execute different blocks of code based on
logical conditions that evaluate to True or False.
4
🐍 DAY 7 – Practice Day (Logic Building)
🎯 Day 7 Goal
By the end of today, you will:
Be confident with basics (Days 1–6)
Think logically using Python
Reduce beginner mistakes
Be ready for loops (Day 8)
🧱 Concepts You’ve Learned So Far
✔ Variables
✔ Data types
✔ Input & output
✔ Operators
✔ Strings
✔ if / elif / else
Now we apply them.
🧱 PRACTICE SET 1 – Numbers & Logic
✅ 1. Even or Odd
num = int(input("Enter number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")
✅ 2. Positive / Negative / Zero
num = int(input("Enter number: "))
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
✅ 3. Largest of Two Numbers
a = int(input("Enter a: "))
b = int(input("Enter b: "))
if a > b:
print("a is greater")
else:
print("b is greater")
🧱 PRACTICE SET 2 – Strings
✅ 4. Count Characters
text = input("Enter string: ")
print("Length:", len(text))
✅ 5. Palindrome Check
text = input("Enter string: ")
if text == text[::-1]:
print("Palindrome")
else:
print("Not palindrome")
✅ 6. Vowel or Consonant
ch = input("Enter character: ").lower()
if ch in "aeiou":
print("Vowel")
else:
print("Consonant")
🧱 PRACTICE SET 3 – Real-Life Programs
✅ 7. Voting Eligibility
age = int(input("Enter age: "))
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible")
✅ 8. Grade Calculator
marks = int(input("Enter marks: "))
if marks >= 90:
print("A Grade")
elif marks >= 75:
print("B Grade")
elif marks >= 50:
print("C Grade")
else:
print("Fail")
✅ 9. Simple Login System
username = input("Enter username: ")
if username == "admin":
print("Login successful")
else:
print("Access denied")
🚫 Common Mistakes to Avoid Today
❌ Forgetting type conversion
❌ Using = instead of ==
❌ Wrong indentation
❌ Writing logic without testing
💡 Always test with multiple inputs.
🧱 Day 7 Summary
Practice is what converts syntax into skill.
Day 7 ensures your Python foundation is solid.