Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
af75779
Revise README for clarity and status update
rihan-png Dec 29, 2025
672e459
add my_practice folder for personal learning
rihan-png Dec 29, 2025
a351798
Add data analysis script using loops
rihan-png Dec 29, 2025
127a5e4
Add Student Management System in C++
rihan-png Jan 1, 2026
1c4bcea
Update Student Management System.cpp
rihan-png Jan 1, 2026
f417f40
Add multiple variable declarations with types
rihan-png Jan 2, 2026
db061aa
Import pyjokes and print a random joke
rihan-png Jan 2, 2026
6c0ba7b
Add script to list directory contents using os module
rihan-png Jan 2, 2026
08b4cd0
Add script to list directory contents
rihan-png Jan 2, 2026
3cd01c6
Delete Chapter 1 - PS directory
rihan-png Jan 3, 2026
69a5318
Add BMI calculation script
rihan-png Jan 3, 2026
6611f3a
Add Pythagorean theorem calculation script
rihan-png Jan 3, 2026
55ef2c9
Update calcualte_bmi.py
rihan-png Jan 3, 2026
5bfdd05
Create remainder.py
rihan-png Jan 8, 2026
88b38b4
Create typecast.py
rihan-png Jan 8, 2026
33a32bf
Create tabspaceandneline.py
rihan-png Jan 9, 2026
190ef23
Update tabspaceandneline.py
rihan-png Jan 9, 2026
64f97d1
Create rules for variable.py
rihan-png Jan 10, 2026
0c28b19
Create operators.py
rihan-png Jan 10, 2026
4c604bd
Create negatiev slicing.py
rihan-png Jan 12, 2026
e5c9f71
Rename negatiev slicing.py to negative_slicing.py
rihan-png Jan 12, 2026
c9f7dba
Update negative_slicing.py
rihan-png Jan 12, 2026
5ca3414
i learn from this how to call inputed variable in string using f() fe…
rihan-png Jan 14, 2026
38db8fd
Create list.py
rihan-png Jan 14, 2026
9e85255
i understand what i can do with list methods
rihan-png Jan 14, 2026
df9b7ef
Create 03_tuple.py
rihan-png Jan 15, 2026
27bfb71
i leaned about tuple methods how i can access and knows about them
rihan-png Jan 15, 2026
f775276
dictonary learned
rihan-png Jan 15, 2026
306026c
i learn this program how set modify and types
rihan-png Jan 18, 2026
a750d28
Correct input and loop syntax in table.py
rihan-png Jan 21, 2026
b3194bc
Add multiplication table for user input number
rihan-png Jan 23, 2026
c936457
Add average calculation function
rihan-png Jan 23, 2026
902a6c1
Correct inch_to_cm function and print statement
rihan-png Jan 24, 2026
aa50bdf
Add age eligibility check program
rihan-png Jan 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 03_tuple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a = (1,45,342,3424,False, "Rihan", "Nihal")
print(a)
print(type(a))
7 changes: 7 additions & 0 deletions 4tuple_methods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a-(1,22,3,45,False,"RIhan")
print(a)
no = a.count(45)
print(no)
i=a.index(3424)
Comment on lines +1 to +5
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 1 uses a-(...) which performs subtraction instead of creating a tuple, so a is never assigned and the rest of the file will fail. Also, a.index(3424) will raise ValueError because 3424 is not present in the tuple values shown.

Suggested change
a-(1,22,3,45,False,"RIhan")
print(a)
no = a.count(45)
print(no)
i=a.index(3424)
a = (1,22,3,45,False,"RIhan")
print(a)
no = a.count(45)
print(no)
i = a.index(45)

Copilot uses AI. Check for mistakes.
print(i)
print(len(a))
24 changes: 0 additions & 24 deletions Chapter 1 - PS/Problem1.py

This file was deleted.

1 change: 0 additions & 1 deletion Chapter 1 - PS/Problem2.py

This file was deleted.

4 changes: 0 additions & 4 deletions Chapter 1 - PS/Problem3.py

This file was deleted.

10 changes: 0 additions & 10 deletions Chapter 1 - PS/Problem4.py

This file was deleted.

12 changes: 12 additions & 0 deletions Chapter 2/rules for variable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
a = 23

aaa = 435

Rihan = 34

sameer = 45

_samerr = 34

# @sameer = 56 # Invalid due to @ symbol
# s@meer # Invalid due to @ symbol
19 changes: 19 additions & 0 deletions FileExplorer.Py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os # 📦 Import the built-in 'os' module to interact with the operating system

# 📂 Select the directory whose contents you want to list
directory_path = '/'
Comment on lines +1 to +4
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename uses an uncommon casing/extension (.Py). On case-sensitive systems this can be easy to mistype and may not match import expectations. Consider renaming to file_explorer.py (or at least FileExplorer.py).

Copilot uses AI. Check for mistakes.
# '/' means the root directory (top-most folder of the file system)
# On Windows, this may raise an error. Example alternative: 'C:\\' or '.' (current folder)

# 🧠 Use the os module to list the directory contents
contents = os.listdir(directory_path)
# os.listdir():
# - Reads all files and folders inside the given directory
# - Returns the result as a Python list of strings
# - Each string is a file or folder name
# - It does NOT give file sizes or details, only names

# 🖨️ Print the contents of the directory
print(contents)
# print():
# - Displays the list of files and folders on the screen
129 changes: 11 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,14 @@
# The Ultimate Python Course
## Python Learning & Practice Repository

Welcome to [**The Ultimate Python Course!**](https://youtu.be/UrsmFxEIp5k)
This repository is forked from CodeWithHarry's Python course.
I use it to learn Python by rewriting examples,
adding my own practice, notes, and small improvements.

This course is designed to take you from a beginner to an advanced Python programmer. The repository contains all the source code, projects, problem sets, and additional resources to supplement your learning.
This is a part of my video The Ultimate Python Couse. Refer to this [video](https://youtu.be/UrsmFxEIp5k) to watch my Python course
### What I am doing here
- Rewriting course code in my own way
- Adding comments and explanations
- Creating small practice programs
- Learning Git and GitHub workflow

## Table of Contents

- [The Ultimate Python Course](#the-ultimate-python-course)
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Chapters](#chapters)
- [Projects](#projects)
- [Problem Sets](#problem-sets)
- [Additional Resources](#additional-resources)
- [How to Use This Repository](#how-to-use-this-repository)

## Introduction

This repository is part of **The Ultimate Python Course** created by [CodeWithHarry](https://www.codewithharry.com/). The course aims to provide a comprehensive guide to learning Python programming.

## Chapters

The course is divided into several chapters, each focusing on different aspects of Python programming:

- **Chapter 1: Modules, Comments & pip**
- Writing the first Python program
- Understanding modules
- Using pip for package management
- Using Python as a calculator
- Comments in Python
- **Chapter 2: Variables and Data Types**
- Defining variables
- Different data types in Python
- Rules for choosing an identifier
- Operators in Python
- Using `type()` function and typecasting
- `input()` function
- **Chapter 3: Strings**
- String slicing
- Slicing with skip values
- String functions
- Escape sequence characters
- **Chapter 4: Lists and Tuples**
- List indexing
- List methods
- Tuples in Python
- Tuple methods
- **Chapter 5: Dictionary & Sets**
- Properties of dictionaries
- Dictionary methods
- Sets in Python
- Properties and operations on sets
- **Chapter 6: Conditional Expression**
- `if`, `else`, and `elif` statements
- Relational and logical operators
- **Chapter 7: Loops in Python**
- `while` loop
- `for` loop
- `range()` function
- `for` loop with `else`
- Break, continue, and pass statements
- **Chapter 8: Functions & Recursions**
- Defining and calling functions
- Recursion in Python
- **Chapter 9: File I/O**
- Reading and writing files
- Working with directories
- **Chapter 10: Object-Oriented Programming**
- Classes and objects
- Methods and attributes
- **Chapter 11: Inheritance & More on OOPs**
- Inheritance
- Polymorphism
- Operator overloading
- **Chapter 12: Advanced Python 1**
- Newly added features in Python
- Walrus operator
- Advanced type hints
- Match case
- Dictionary merge & update operators
- Exception handling enhancements
- Global keyword and enumerate function
- List comprehensions
- **Chapter 13: Advanced Python 2**
- Virtual environments
- Lambda functions
- String methods: `join` and `format`
- Functional programming: `map`, `filter`, and `reduce`

## Projects

- **Project 1: Snake Water Gun Game**
- A fun and interactive game where the player competes against the computer in a variation of Rock-Paper-Scissors.
- **Project 2: Guess The Number**
- A guessing game where the player tries to guess a randomly generated number within a certain range.
- **Mega Project 1: Jarvis Virtual Assistant**
- A voice assistant application capable of performing various tasks such as playing music, and providing information.
- **Mega Project 2: AI AutoReply Bot**
- An AI-based bot designed to automatically reply to messages, enhancing communication efficiency.

## Problem Sets

Each chapter contains problem sets to test your understanding and to practice coding. The problem sets include various challenges and exercises relevant to the chapter's content.

## Additional Resources

- **[Download the Handbook](https://github.com/CodeWithHarry/The-Ultimate-Python-Course/blob/main/The%20Ultimate%20Python%20Handbook.pdf)**
- **[Download the Handwritten Notes](https://www.codewithharry.com/notes)**
- **[Download the Ultimate Python Cheatsheet](https://www.codewithharry.com/blogpost/python-cheatsheet/)**

## How to Use This Repository

1. **Clone the repository** to your local machine using:
```sh
git clone https://github.com/CodeWithHarry/The-Ultimate-Python-Course.git
```
2. **Navigate through the chapters** to find the relevant lessons and code examples.
3. **Complete the problem sets** provided at the end of each chapter to solidify your understanding.
4. **Work on the projects** to apply your knowledge in real-world scenarios.
### Status
Ongoing learning (updated weekly)
9 changes: 9 additions & 0 deletions access content direct through os module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os

#select the directory whose content you wnat to list
directory_path = '/'

#use the os module to list the directory content
contents = os.listdir(directory_path)
#print the contents of the directory
print(contents)
12 changes: 12 additions & 0 deletions age_eligibility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
a = int(input("Enter your age: "))

# If else statement
if(a>=18):
print("You are above the age of consent")
print("Good for you")

else:
print("You are below the age of consent")


print("End of Program")
5 changes: 5 additions & 0 deletions avgfunction.pty
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a = 12
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename uses a non-standard extension (.pty), which prevents Python tooling (linters, test discovery, editors) from recognizing this as a Python script. Consider renaming the file to use .py.

Copilot uses AI. Check for mistakes.
b = 34
c = 56
average =(a + b + c)/3
print(average)
9 changes: 9 additions & 0 deletions calcualte_bmi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BMI 🏋️‍♀️
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename calcualte_bmi.py appears to be misspelled ("calcualte" vs "calculate"), which can make it harder to find/import later. Consider renaming the file to calculate_bmi.py.

Copilot uses AI. Check for mistakes.


weight = 92.3
height = 1.86

bmi = weight / (height**2)

print(bmi)
6 changes: 6 additions & 0 deletions diconary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
d={} #empty dictonary
marks= {
"Rihan":100,
"Nihal":99,
}
print(marks["Rihan:"])
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marks["Rihan:"] will raise a KeyError because the dictionary key is "Rihan" (no colon). Use the exact key name when indexing the dict.

Suggested change
print(marks["Rihan:"])
print(marks["Rihan"])

Copilot uses AI. Check for mistakes.
2 changes: 2 additions & 0 deletions fvarible{},py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name = input("enter your name")
print(f"Good morning,{name}")
Comment on lines +1 to +2
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename fvarible{},py contains {}, a comma, and a non-standard extension separator, which makes it difficult to run/import and inconsistent with typical Python module naming. Consider renaming the file to a valid module name (e.g., fvariable.py).

Copilot uses AI. Check for mistakes.
4 changes: 4 additions & 0 deletions inches_to_cm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def inch_to_cm(inch)
return inch * 2.54
n = int(input('enter value in inches: "))
print(f"the corresponding vlaue in cms is (inches_to_cms(n)}")
Comment on lines +1 to +4
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function/file won’t run due to syntax errors: missing : after the def line, inconsistent string quotes in the input(...) call, and the final print(...) references a different name (inches_to_cms) than the function defined. Fix the function signature and use the correct function name in the f-string.

Suggested change
def inch_to_cm(inch)
return inch * 2.54
n = int(input('enter value in inches: "))
print(f"the corresponding vlaue in cms is (inches_to_cms(n)}")
def inch_to_cm(inch):
return inch * 2.54
n = int(input("enter value in inches: "))
print(f"the corresponding vlaue in cms is {inch_to_cm(n)}")

Copilot uses AI. Check for mistakes.
6 changes: 6 additions & 0 deletions list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
purchase list = ["Apples","Orange",5,43.5,False,"Aakash","ROhan"]

prints(friends[0])
friends[0]="Grapes" #unlike list strings are mutable
print(friends[0])
print(friends[1:4])
Comment on lines +1 to +6
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 1 is invalid Python (purchase list is not a valid identifier). Additionally, lines 3–6 reference friends (never defined) and call prints(...) (not defined). Rename the variable (e.g., purchase_list) and consistently use that variable with print(...).

Suggested change
purchase list = ["Apples","Orange",5,43.5,False,"Aakash","ROhan"]
prints(friends[0])
friends[0]="Grapes" #unlike list strings are mutable
print(friends[0])
print(friends[1:4])
purchase_list = ["Apples", "Orange", 5, 43.5, False, "Aakash", "ROhan"]
print(purchase_list[0])
purchase_list[0] = "Grapes" # unlike list strings are mutable
print(purchase_list[0])
print(purchase_list[1:4])

Copilot uses AI. Check for mistakes.
11 changes: 11 additions & 0 deletions list_methodft.wwe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
candidates = ["John cena","undertaker","Roman Reings",5,4.45,True]
prints(candidates)
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prints(candidates) will raise NameError because prints is not defined. Use print(candidates) if the intent is to display the list.

Suggested change
prints(candidates)
print(candidates)

Copilot uses AI. Check for mistakes.
candidates.append("The Rock")
l1=[1,23,54,67,32,12]
Ranks=[1,23,54,67,32,12]
#l1.sort()
#l1.reverse()
#l1.insert(2,22222)
disqualified= Ranks.pop(3)
print(disqualified)
print(Ranks)
3 changes: 3 additions & 0 deletions my_practice/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This folder contains my own Python practice,
rewritten examples, and experiments.

1 change: 1 addition & 0 deletions my_practice/Student Management System.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

9 changes: 9 additions & 0 deletions my_practice/datatypes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
a = 1 # a is an integer

b = 5.22 # b is a floating point number

c = "Harry" # c is a string

d = False # d is a boolean variable

e = None # e is a none type variable
58 changes: 58 additions & 0 deletions my_practice/practice-loops
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# My Data Analysis Practice: Loops
# This script shows how to process data lists using loops.
Comment on lines +1 to +2
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script has no file extension, so many editors/tools won’t treat it as Python. Consider renaming it to something like practice_loops.py (or similar) to match the rest of the repo’s Python files.

Copilot uses AI. Check for mistakes.

def analyze_data():

# --- PART 1: The 'For' Loop (Iterating through an Array/List) ---
# Scenario: I have a list of daily sales figures. I want to print each one.
print("1. Reading Daily Sales Data:")
daily_sales = [150, 200, 350, 400, 500]

# "sale" is a variable that holds one number at a time from the list
for sale in daily_sales:
print("Processing sale amount: $", sale)

print("-" * 30)

# --- PART 2: Filtering Data (Loop with Condition) ---
# Scenario: I only want to count days where sales were high (above 300).
print("2. Filtering High Sales (> 300):")

count = 0
for sale in daily_sales:
if sale > 300:
print("Found high sale:", sale)
count = count + 1

print("Total high revenue days:", count)

print("-" * 30)

# --- PART 3: The 'While' Loop (Data Cleaning) ---
# Scenario: removing '0' or bad data until the list is clean.
print("3. Cleaning Data (Removing Zeros):")
raw_data = [10, 0, 50, 0, 20]

# While '0' exists inside the raw_data list, remove it
while 0 in raw_data:
raw_data.remove(0)
print("Removed a zero... Current data:", raw_data)

print("Final Cleaned Data:", raw_data)

print("-" * 30)

# --- PART 4: Break and Continue ---
# Scenario: Searching for a specific error value (like -1).
print("4. searching for Errors:")
dataset = [12, 45, -1, 60, 100]

for value in dataset:
if value == -1:
print("Error found! Corrupted data detected. Stopping analysis.")
break # Stops the loop completely
print("Checking value:", value)

# Run the analysis function
if __name__ == "__main__":
analyze_data()
7 changes: 7 additions & 0 deletions my_practice/pyjokes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import pyjokes

# print("printing jokes")

# this prints a random jokes
joke=pyjokes.getjokes()
print(jokes)
Comment on lines +6 to +7
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyjokes.getjokes() is not the API used elsewhere in this repo (see Chapter 1/module.py:6 which uses pyjokes.get_joke()), and print(jokes) references an undefined variable (you assigned to joke). Update the call and print the correct variable.

Suggested change
joke=pyjokes.getjokes()
print(jokes)
joke = pyjokes.get_joke()
print(joke)

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +7
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module 'pyjokes' imports itself.

Suggested change
import pyjokes
# print("printing jokes")
# this prints a random jokes
joke=pyjokes.getjokes()
print(jokes)
import random
# print("printing jokes")
# this prints a random jokes
_JOKES = [
"Why do Python developers wear glasses? Because they can't C.",
"There are only 10 kinds of people in this world: those who know binary and those who don't.",
"A programmer walks into a bar and orders 1.000000119 beers.",
]
def getjokes():
"""Return a random joke from the local joke list."""
return random.choice(_JOKES)
joke = getjokes()
print(joke)

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print statement may execute during import.

Suggested change
joke=pyjokes.getjokes()
print(jokes)
def main():
joke = pyjokes.getjokes()
print(joke)
if __name__ == "__main__":
main()

Copilot uses AI. Check for mistakes.
8 changes: 8 additions & 0 deletions negative_slicing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name="Rihan"
print(name[0:3])

print(name[-4:1])
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print(name[-4:1]) will always print an empty string for name = "Rihan" because the computed start and end indices are the same (1 to 1). If the goal is to demonstrate negative slicing, consider using a range where the end index is greater than the start (e.g., -4:-1).

Suggested change
print(name[-4:1])
print(name[-4:-1])

Copilot uses AI. Check for mistakes.
print(name[1:4])

print(name[:4])

Loading
Loading