You are on page 1of 4

library1={}

library2={}
library3={}
print("***** Welcome to SIT Mini Student Information System *****")
print("Number of students in the system:", len(library1))
print("These are the functions available:")
print("Enter 1 to Add a new student")
print("Enter 2 to Update an existing student info")
print("Enter 3 to Remove an existing student info")
print("Enter 4 to Display all student information in the system")
print("Enter 5 to Search for student(s)")
print("Enter -1 to Exit the application")
choice = int(input("Enter Your Choice: "))

def func1():
print("== Add a new student ==")
adminno = str(input("Enter the admission number: "))
if adminno in library1.keys():
adminno = str(input("Please enter a new admission number or enter 0
to return to main menu: "))
if adminno == "0":
return
studentname = str(input("Please enter the student name:"))
modulename = str(input("Please enter the module name:"))
score = int(input("Please enter the score:"))
library1.update({adminno: studentname})
library2.update({adminno: modulename})
library3.update({adminno: score})
print("Student added!")

def func2():
print("== Update student ==")
admin = str(input("Please enter the admission number of the student you
would like to update: "))
if admin in library1.keys():
UpdateName = str(library1.get(admin))
UpdateModule = str(library2.get(admin))
UpdateScore = int(library3.get(admin))
print("Admission Number: " + admin)
print("Student Name: " + UpdateName)
print("Module Name: " + UpdateModule)
print("score: ", UpdateScore)
print("Student Exist!")
print("Enter 1 to Update Name")
print("Enter 2 to Update Module Name")
print("Enter 3 to Update score")
print("Enter 0 to return to Main Menu")
UpdateChoice = int(input("What would you like to Update? "))
if UpdateChoice == 1:
UpdateName = str(input("Enter the new student name: "))
library1[admin] = UpdateName
print("Student Name Updated!")
elif UpdateChoice == 2:
UpdateModule = str(input("Enter the new module name: "))
library2[admin] = UpdateModule
print("Module Name Updated!")
elif UpdateChoice == 3:
UpdateScore = int(input("Enter the new score: "))
library3[admin] = UpdateScore
print("Score Updated!")
elif UpdateChoice == 0:
return

else:
print("No such student found.")
return

def func3():
print("== Remove student ==")
admin = str(input("Please enter the admission number you want to
remove: "))
if admin in library1.keys():
RemoveName = str(library1.get(admin))
RemoveModule = str(library2.get(admin))
RemoveScore = str(library3.get(admin))
print("Admission Number: " + admin)
print("Student Name: " + RemoveName)
print("Module Name: " + RemoveModule)
print("score: " + RemoveScore)
removal = str(input("Is this the student you want to remove?
(Yes/No)"))
if removal == "Yes":
del library1[admin]
del library2[admin]
del library3[admin]
else:
print("Student info was not removed!")

def func4():
print("== Display all students ==")
for key in library1.keys():
print("Admission Number: " + key)
print("Student Name: " + library1.get(key))
print("Module Name: " + library2.get(key))
print("score: " + str(library3.get(key)))

def func5():
print("== Search Student ==")
print("Search By:")
print("Enter 1 to search by Admission Number")
print("Enter 2 to search by Module Name")
print("Enter 3 to search by Score Range")
print("Enter 0 to return to Main Menu")
searchMethod = int(input("Your choice: "))
while searchMethod != 0:
if searchMethod == 1:
adminno = str(input("Please enter the admission number you wish
to search by: "))
if adminno in library1.keys():
print("Admission Number: " + adminno)
print("Student Name: " + library1.get(adminno))
print("Module Name: " + library2.get(adminno))
print("score: " + str(library3.get(adminno)))
else:
print("No student with this admission number found!")

elif searchMethod == 2:
coursemodules = str(input("Please enter the module name you
wish to search by: "))
for adminno, modules in library2.items():
if coursemodules == modules:
print("Admission number: " + adminno)
print("Student Name: " + library1.get(adminno))
print("Module Name: " + library2.get(adminno))
print("score: " + str(library3.get(adminno)))
if coursemodules not in library2.values():
print("No student with this module name found!")

elif searchMethod == 3:
print("Please enter the range of score you wish to search by:
")
scoreminimum = int(input("Minimum score: "))
scoremaximum = int(input("Maximum score: "))
for adminno, scorerange in library3.items():
if scorerange in range(scoreminimum, scoremaximum + 1):
print("Admission number: " + adminno)
print("Student Name: " + library1.get(adminno))
print("Module Name: " + library2.get(adminno))
print("score: " + str(library3.get(adminno)))
if library3.values() in range(scoreminimum, scoremaximum+1):
print("No student within this range found!")

print("== Search Student ==")


print("Search By:")
print("Enter 1 to search by Admission Number")
print("Enter 2 to search by Module Name")
print("Enter 3 to search by Score Range")
print("Enter 0 to return to Main Menu")
searchMethod = int(input("Your choice: "))

while choice != -1:


if choice == 1:
func1()
elif choice == 2 and len(library1) == 0:
print("There is no student information currently in the system!")
elif choice == 2 and len(library1) != 0:
func2()
elif choice == 3 and len(library1) == 0:
print("There is no student information currently in the system!")
elif choice == 3 and len(library1) != 0:
func3()
elif choice == 4 and len(library1) == 0:
print("There is no student information currently in the system!")
elif choice == 4 and len(library1) != 0:
func4()
elif choice == 5 and len(library1) == 0:
print("There is no student information currently in the system!")
elif choice == 5 and len(library1) != 0:
func5()

print("***** Welcome to SIT Mini Student Information System *****")


print("Number of students in the system:", len(library1))
print("These are the functions available:")
print("Enter 1 to Add a new student")
print("Enter 2 to Update an existing student info")
print("Enter 3 to Remove an existing student info")
print("Enter 4 to Display all student information in the system")
print("Enter 5 to Search for student(s)")
print("Enter -1 to Exit the application")
choice = int(input("Enter Your Choice: "))

You might also like