Advertisement
Guest User

Untitled

a guest
Nov 12th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. import statistics
  2.  
  3. admins={'Python':'user123@','Java':'user@123','NodeJS':'qwer123@','ReactJS':'qwer@123'}
  4.  
  5. studentDict={'Utkarsh':[78,88,99],'Sakshi':[74,85,96],'Jyoti':[71,82,93],'Trpti':[73,81,92]}
  6.  
  7. def enterGrades():
  8. nameToEnter=input('Student Name: ')
  9. gradeToEnter=input('Grade: ')
  10.  
  11. if nameToEnter in studentDict:
  12. print('Adding Grade...')
  13. studentDict[nameToEnter].append(gradeToEnter)
  14. else:
  15. print('Student does not exist.')
  16. print(studentDict)
  17.  
  18. def removeStudent():
  19. nameToRemove=input('Student: ')
  20. if nameToRemove in studentDict:
  21. print('Removing strudent...')
  22. del studentDict[nameToRemove]
  23. else:
  24. print('Student does not exist.')
  25. print(studentDict)
  26.  
  27. def studentAvg():
  28. for eachStudent in studentDict:
  29. gradeList=studentDict[eachStudent]
  30. avgGrade=statistics.mean(gradeList)
  31. print(eachStudent,'has an avgerage grade of',avgGrade)
  32.  
  33. def main():
  34. print("""
  35. Welcome to Grade Central
  36.  
  37. [1]-Enter Grades
  38. [2]-Remove Student
  39. [3]-Student Avg. Grades
  40. [4]-Exit
  41. """)
  42. action=input('What would you like to do today?!! (Enter a Number) ')
  43.  
  44. if action=='1':
  45. enterGrades()
  46. elif action=='2':
  47. removeStudent()
  48. elif action=='3':
  49. studentAvg()
  50. elif action=='4':
  51. exit()
  52. else:
  53. print('No choice given,try again')
  54.  
  55. login=input('Username: ')
  56. passw=input('Password: ')
  57.  
  58. if login in admins:
  59. if admins[login]==passw:
  60. print('Welcome',login)
  61. while True:
  62. main()
  63. else:
  64. print('Invalid Password')
  65.  
  66. else:
  67. print('Invalid Username,informing administrator')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement