Advertisement
Guest User

Untitled

a guest
Nov 27th, 2022
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. def main():
  2. correctList = ["A","C","A","B","B","D","D","A","C","A","B","C","D","C","B"]
  3. studentList = ["","","","","","","","","","","","","","",""]
  4. correctList = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
  5. numCorrect = 0
  6. numIncorrect = []
  7. again = "y"
  8. passCount =0
  9. while again == "y":
  10. print("\nQuiz Grading App ...")
  11. studentName = input("\nEnter name of student: ")
  12. fileName = input(" \" quiz answers file: ")
  13. studentList = open(fileName,"r")
  14. for i in range(15):
  15. if studentList.readline == correctList[i]:
  16. numCorrect +=1
  17. else:
  18. numIncorrect.append(i+1)
  19. studentList.close
  20. print(studentName + " Quiz Results")
  21. print("---------------------------------------------")
  22. print("Correct Answers: ",numCorrect)
  23. print("Incorrect Answers: ",len(numIncorrect),end="")
  24. if len(numIncorrect) > 0:
  25. print(" ( ",end="")
  26. for i in numIncorrect:
  27. print(i, end="")
  28. print(")")
  29. # Comparing results
  30. if numCorrect >= 11:
  31. print("\nStudent PASSED the quiz.\n")
  32. else:
  33. print("\nStudent FAILED the quiz.\n")
  34. again = input("\nDo you have another student (y/n)? ")
  35. if again.lower() == 'n':
  36. break
  37. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement