Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from statistics import mean as m
- SDict = {'Jeff':[78,88,93],
- 'Alex':[92,76,88],
- 'Sam': [89,92,93]}
- admins = {'Jenny':'8675309',
- 'Jimmy':'Hendrix'}
- def home():
- print('''\n Welcome to Inner City Schools!
- [1] - Enter grades.
- [2] - Remove a student.
- [3] - Student average grades.
- [4] - Exit
- ''')
- action = input('\n''What would you like to do?: ')
- if action == '1':
- print('You have chosen to enter grades''\n')
- addGrade()
- elif action == '2':
- print('You have chosen to remove a student.''\n')
- removeStudent()
- elif action == '3':
- StAvg()
- elif action == '4':
- print('Goodbye.')
- exit()
- else:
- print('Please try again.')
- def addGrade():
- student = input('Please enter student name: ')
- grade = input('Please enter '+student+'\'s grade: ')
- if student in SDict:
- print('Adding grade...')
- SDict[student].append(float(grade))
- else:
- print('No student by that name.')
- print(SDict)
- def removeStudent():
- student = input('Please enter student name: ')
- if student in SDict:
- print('Removing student...')
- del SDict[student]
- else:
- print('\n''No student by that name.''\n')
- print(SDict)
- def StAvg():
- for eachStudent in SDict:
- gradeList = SDict[eachStudent]
- avgGrade = m(gradeList)
- print(eachStudent,'Has an average grade of:', avgGrade)
- login = input('username: ')
- passw = input('Password: ')
- if login in admins and admins [login] == passw:
- print('Welcome',login)
- while True:
- home()
- else:
- print('Invalid username or password')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement