Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import statistics
- admins={'Python':'user123@','Java':'user@123','NodeJS':'qwer123@','ReactJS':'qwer@123'}
- studentDict={'Utkarsh':[78,88,99],'Sakshi':[74,85,96],'Jyoti':[71,82,93],'Trpti':[73,81,92]}
- def enterGrades():
- nameToEnter=input('Student Name: ')
- gradeToEnter=input('Grade: ')
- if nameToEnter in studentDict:
- print('Adding Grade...')
- studentDict[nameToEnter].append(gradeToEnter)
- else:
- print('Student does not exist.')
- print(studentDict)
- def removeStudent():
- nameToRemove=input('Student: ')
- if nameToRemove in studentDict:
- print('Removing strudent...')
- del studentDict[nameToRemove]
- else:
- print('Student does not exist.')
- print(studentDict)
- def studentAvg():
- for eachStudent in studentDict:
- gradeList=studentDict[eachStudent]
- avgGrade=statistics.mean(gradeList)
- print(eachStudent,'has an avgerage grade of',avgGrade)
- def main():
- print("""
- Welcome to Grade Central
- [1]-Enter Grades
- [2]-Remove Student
- [3]-Student Avg. Grades
- [4]-Exit
- """)
- action=input('What would you like to do today?!! (Enter a Number) ')
- if action=='1':
- enterGrades()
- elif action=='2':
- removeStudent()
- elif action=='3':
- studentAvg()
- elif action=='4':
- exit()
- else:
- print('No choice given,try again')
- login=input('Username: ')
- passw=input('Password: ')
- if login in admins:
- if admins[login]==passw:
- print('Welcome',login)
- while True:
- main()
- else:
- print('Invalid Password')
- else:
- print('Invalid Username,informing administrator')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement