Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import statistics
- admin = {"admin":"ninja"}
- studentDict = {'Jeff':[78,88,83],
- 'Alex':[42,76,88],
- 'Sam':[89,92,93]}
- def enterGrades():
- nametoEnter = input("Student Name : ")
- gradetoEnter = input("Grade : ")
- if nametoEnter in studentDict:
- print("Adding Grade...")
- studentDict[nametoEnter] = (int(gradetoEnter))
- else:
- print("Student does not exist.")
- def removeStudent():
- studentToRemove = input("What student would you like to delete?")
- if studentToRemove in studentDict:
- del studentDict[studentToRemove]
- print("removeing student")
- else:
- print("we did not find that student")
- def studentAverage():
- peeraverage = input("What is the student you want to check?")
- if peeraverage in studentDict:
- print("getting average")
- avg = statistics.mean(studentDict[peeraverage])
- print(avg)
- def addStudent():
- studentToAdd = input("What is the student you want to add?")
- if studentToAdd in studentDict:
- print("it appears that you have a copy, please enter a different name.")
- else:
- newstudentgrades = input("what is the person grades?")
- studentDict[studentToAdd] = (int(newstudentgrades))
- print('adding grades')
- def listStudents():
- for key in studentDict.keys():
- print("Student: {}".format(key))
- def main():
- print("""
- [1] - Enter Grades
- [2] - Delete Students
- [3] - Average Grade
- [4] - Exit
- [5] - Add Student
- [6] - List Students
- """)
- action = str(input("what is your command?"))
- if action == '1':
- enterGrades()
- elif action == '2':
- removeStudent()
- elif action == '3':
- studentAverage()
- elif action == '4':
- exit()
- elif action == '5':
- addStudent()
- elif action == '6':
- listStudents()
- else:
- print("you didn't enter a correct command.")
- login = input('Username: ')
- passw = input('Password: ')
- if login in admin:
- if admin[login] == passw:
- print("welcome")
- while True:
- main()
- else:
- print("wrong password.")
- else:
- print("wrong username")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement