Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. def editStudentRecord(): #Menu option 2 - Edit existing student info
  2. checkForStudent = (input("Enter the student number: (FORMAT-S0000) >"))
  3.  
  4. if checkForStudent in STUDENT_INFO_DICTIONARY.keys():
  5. print("Records for student: ", checkForStudent , " available.")
  6. print(STUDENT_INFO_DICTIONARY[checkForStudent])
  7. while True: #Gather student information from the user
  8. tempForename = input("Enter students forename: >")
  9. tempSurname = input("Enter students surname: >")
  10.  
  11. while True:
  12. print("NOTE: Information entered as a number between 0.0 and 100.0 ONLY!!")
  13. tempMark1 = float(input("Enter students Mark for Assessment 1: >"))
  14. tempMark2 = float(input("Enter students Mark for Assessment 2: >"))
  15. tempMark3 = float(input("Enter students Mark for Assessment 3: >"))
  16. tempAverage = ((tempMark1 + tempMark2 + tempMark3)/3)
  17. if (tempMark1 >= 0 and tempMark1 <= 100 and tempMark2 >= 0 and tempMark2 <= 100 and tempMark3 >= 0 and tempMark3 <= 100):
  18. break
  19. else:
  20. print("Invalid marking information! Please re-enter correctly.")
  21.  
  22. print("Information entered for new student: Forename-",tempForename," Surname-",tempSurname," Assessment 1-",tempMark1," Assessment 2-",tempMark2," Assessment 3- ",tempMark3," Average -",tempAverage,"%")
  23. confirmInfo = input("Please confirm information is correct (Y/N): >").upper()
  24.  
  25. if (confirmInfo == "Y"):
  26. STUDENT_INFO_DICTIONARY[checkForStudent] = {(tempForename, tempSurname, str(tempMark1), str(tempMark2), str(tempMark3), str(tempAverage),"%")}
  27. print("Information on the student has been stored! Press enter to return to main menu.")
  28. return False
  29. elif (confirmInfo == "N"):
  30. print("Please re-enter information correctly.")
  31. else:
  32. print("Invalid option! Please re-enter information correctly")
  33. else:
  34. print("Student NOT on system! Press enter to return to main menu.")
  35. input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement