I am trying to create a simple database on python that:
- Add a record, delete a record, report on the database
(I am very new to this program and programming in general)
*NOTE: I am aware there are programs like SQL but my professor wants us to create a a database simply with what we learned in class *
I am having serious trouble on being able to store: ID, Class Name, and Class instructor
into one record of "Classes". I have been able to display the class ID and class name but I'm not sure how to add an instructor's name.
This is what I have currently:
def print_menu():
print('1. Print Class Records')
print('2. Add a Class')
print()
classes = {}
menu_choice = 0
print_menu()
while menu_choice != 5:
menu_choice = int(input("Type in a number (1-5): "))
if menu_choice == 1:
print("Class Reports:")
for x in classes.keys():
print("Class ID: ", x, "\tClass Name:", classes[x], "\tClass Instructor:",)
print()
elif menu_choice == 2:
print("Add ClassID, Class Name, and Instructor Name")
classID = input("ID: ")
className = input("Class Name: ")
classInst = input("Class Instructor: ")
classes[classID] = className
elif menu_choice != 5:
print_menu()
I feel that I will be able to do the rest of the professor's requirements for this project but I have been stuck on this part for days with no response from my professor
I would highly appreciate quick responses as this assignment is due tonight at 11:59 and I am reaching out for help here as a last resort.
Thank you!
classes[classID]; i.e.classes[classID] = [className, classInst]orclasses[classID] = {'name': className, 'instructor': classInst}. I don't want to give out too much info, as you need to figure this out on your own ;-) But I think this will probably put you on the right track to do the rest yourself.