5.
Code (Python)
# Time Table Management System in Python
timetable = {}
def add_class(day, time, subject):
if day not in timetable:
timetable[day] = {}
timetable[day][time] = subject
def display_timetable():
for day, schedule in timetable.items():
print(f"\n{day}:")
for time, subject in schedule.items():
print(f"{time} - {subject}")
def main():
while True:
print("\n--- Time Table Management ---")
print("1. Add Class")
print("2. Display Timetable")
print("3. Exit")
choice = input("Enter your choice: ")
if choice == '1':
day = input("Enter Day: ")
time = input("Enter Time: ")
subject = input("Enter Subject: ")
add_class(day, time, subject)
elif choice == '2':
display_timetable()
elif choice == '3':
break
else:
print("Invalid choice. Try again.")
if __name__ == "__main__":
main()
6. Sample Run
--- Time Table Management ---
1. Add Class
2. Display Timetable
3. Exit
Enter your choice: 1
Enter Day: Monday
Enter Time: 9:00 AM - 10:00 AM
Enter Subject: Mathematics
--- Time Table Management ---
1. Add Class
2. Display Timetable
3. Exit
Enter your choice: 2
Monday:
9:00 AM - 10:00 AM - Mathematics
7. Limitations
- This project uses a console interface; no graphical interface is provided.
- Time and subjects must be manually entered.
- Data is not saved permanently; the schedule resets after the program ends.
8. Conclusion
This project has helped me understand how to design and implement a basic time table system
using Python. I learned about data structures like dictionaries and how to create a menu-based
program.
9. Bibliography
1. www.geeksforgeeks.org
2. www.w3schools.com/python/
3. Python documentation (docs.python.org)
4. Class notes and textbooks