Course Content
Programming Foundations Topics:
-Introduction to Python -Installing Python & Setting Up IDE -Variables, Data Types & Operators -Input & Output -Conditional Statements (if, else, elif) -Loops (for, while) -Functions and Parameters -Error Handling (Try/Except)
0/9
Web Development with Python
Topics: Introduction to Flask Introduction to Django Building Your First Web App Routing and Templates Handling Forms Connecting to Databases (SQLite/MySQL) User Authentication Deploying Python Apps Online
Data Science & AI
Topics: Python for Data Analysis Numpy & Pandas Basics Data Cleaning Techniques Data Visualization (Matplotlib, Seaborn) Introduction to Machine Learning (Scikit-Learn) Supervised vs Unsupervised Learning Linear Regression, KNN, and Decision Trees Basic Neural Networks
Automation & Scripting
Topics: Automating Files and Folders Sending Emails with Python Web Scraping (BeautifulSoup, Selenium) Working with Excel & CSV files Scheduling Tasks with Python Scripts PDF and Image Manipulation
Game Development
Topics: Intro to Pygame Creating a Game Window Sprite Movement & Collision Score Tracking Sound and Music in Games Game Projects: Pong, Snake, Flappy Bird
Career & Interview Prep
Topics: Common Python Coding Problems String & List Manipulation Challenges Recursion & Algorithm Practice Big-O Notation Basics Cracking Python Interview Questions Building a Python Portfolio
Advanced Python
Topics: Object-Oriented Programming (OOP) Working with APIs (REST APIs, JSON) Unit Testing with unittest File Handling (Text, JSON, Pickle) Decorators, Generators, and Lambda Functions Multithreading & Asynchronous Programming
Python Full Course

📝 Overview

Conditional statements allow your Python programs to make decisions. You’ll learn how to use if, elif, and else to control the flow of your code based on conditions.


🎯 What You’ll Learn

  • How to use if, elif, and else statements

  • How conditions are evaluated

  • Common examples like grade checking or login simulation


1. What Are Conditional Statements?

Conditional statements let your program choose what to do based on conditions.


📌 2. The Basic Structure

python
if condition:
# do something
elif another_condition:
# do something else
else:
# fallback action

Python uses indentation (spacing) to group blocks of code!


🧪 Example 1: Simple Age Checker

python
age = int(input("Enter your age: "))

if age >= 18:
print("You are an adult.")
else:
print("You are a minor.")


🔁 3. The elif Keyword

You can test multiple conditions using elif (short for else if):

python
grade = int(input("Enter your score: "))

if grade >= 90:
print("Grade: A")
elif grade >= 80:
print("Grade: B")
elif grade >= 70:
print("Grade: C")
else:
print("Grade: F")


⚠️ 4. Comparison & Logical Operators

Operator Meaning
== Equal to
!= Not equal
> / < Greater/Less than
>= / <= Greater/Less or equal

You can combine conditions:

python
username = "admin"
password = "1234"

if username == "admin" and password == "1234":
print("Access granted.")
else:
print("Access denied.")


🧠 Practice Exercise

Write a Python program that:

  • Asks the user for a number

  • Prints if the number is positive, negative, or zero

python
num = float(input("Enter a number: "))

if num > 0:
print("Positive number")
elif num < 0:
print("Negative number")
else:
print("Zero")


Summary

  • if, elif, and else are used to make decisions

  • Conditions must be True to run the associated block

  • Python uses indentation, not brackets {}


⏭️ Next Lesson Preview

→ Loops in Python (for and while)