Python Project Practical Notebook
Project 1: Student Marks Calculator
Objective:
To take marks of 5 subjects and calculate total, average and grade.
Tools Used:
Python 3, Basic I/O, if-else, arithmetic operators
Source Code:
# Student Marks Calculator
name = input("Enter student name: ")
marks = []
for i in range(5):
m = int(input(f"Enter marks of subject {i+1}: "))
marks.append(m)
total = sum(marks)
average = total / 5
if average >= 90:
grade = 'A'
elif average >= 75:
grade = 'B'
elif average >= 60:
grade = 'C'
Python Project Practical Notebook
else:
grade = 'D'
print("Name:", name)
print("Total Marks:", total)
print("Average Marks:", average)
print("Grade:", grade)
Output Explanation:
It takes 5 subject marks and shows total, average and grade based on average score.
Conclusion:
This project helps to understand how to take input in list and apply conditions.
Project 2: Simple Calculator
Objective:
To perform basic arithmetic operations using functions.
Tools Used:
Python 3, functions, if-else
Source Code:
# Simple Calculator
def add(a, b):
Python Project Practical Notebook
return a + b
def subtract(a, b):
return a - b
def multiply(a, b):
return a * b
def divide(a, b):
return a / b
print("Select operation: +, -, *, /")
op = input("Enter operator: ")
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
if op == '+':
print("Result:", add(a, b))
elif op == '-':
print("Result:", subtract(a, b))
elif op == '*':
print("Result:", multiply(a, b))
elif op == '/':
print("Result:", divide(a, b))
else:
print("Invalid operator")
Output Explanation:
Python Project Practical Notebook
It performs addition, subtraction, multiplication or division based on user input.
Conclusion:
This project helps to understand how to use functions and take user input in Python.
Project 3: To-Do List App (CLI)
Objective:
To manage daily tasks by adding and viewing them.
Tools Used:
Python 3, list, loops
Source Code:
# To-Do List App
tasks = []
while True:
print("\n1. Add Task\n2. View Tasks\n3. Exit")
choice = input("Enter your choice: ")
if choice == '1':
task = input("Enter task: ")
tasks.append(task)
elif choice == '2':
Python Project Practical Notebook
print("Your Tasks:")
for i, t in enumerate(tasks, start=1):
print(f"{i}. {t}")
elif choice == '3':
break
else:
print("Invalid choice!")
Output Explanation:
User can add tasks and view the current to-do list. The loop continues until user exits.
Conclusion:
This project helps to understand list usage and menu-driven programming in Python.
Project 4: Number Guessing Game
Objective:
To guess a randomly generated number by the computer.
Tools Used:
Python 3, random module, loops
Source Code:
# Number Guessing Game
import random
Python Project Practical Notebook
number = random.randint(1, 10)
guess = int(input("Guess a number between 1 to 10: "))
if guess == number:
print("Congratulations! You guessed it right.")
else:
print(f"Sorry! The number was {number}. Try again.")
Output Explanation:
Generates a random number and checks whether user's guess is correct.
Conclusion:
This project helps to understand random module and conditional statements.
Project 5: Library Management System (Basic)
Objective:
To manage a small book list by adding and viewing books.
Tools Used:
Python 3, list, loop, menu
Source Code:
# Library Management System
Python Project Practical Notebook
books = []
while True:
print("\n1. Add Book\n2. View Books\n3. Exit")
ch = input("Enter choice: ")
if ch == '1':
book = input("Enter book name: ")
books.append(book)
elif ch == '2':
print("Books in library:")
for b in books:
print("-", b)
elif ch == '3':
break
else:
print("Invalid choice")
Output Explanation:
User can add books to a list and view them. Works through a menu loop.
Conclusion:
This project helps to understand list handling and menu-based programs.