Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- correctList = ["A","C","A","B","B","D","D","A","C","A","B","C","D","C","B"]
- studentList = ["","","","","","","","","","","","","","",""]
- correctList = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False]
- numCorrect = 0
- numIncorrect = []
- again = "y"
- passCount =0
- while again == "y":
- print("\nQuiz Grading App ...")
- studentName = input("\nEnter name of student: ")
- fileName = input(" \" quiz answers file: ")
- studentList = open(fileName,"r")
- for i in range(15):
- if studentList.readline == correctList[i]:
- numCorrect +=1
- else:
- numIncorrect.append(i+1)
- studentList.close
- print(studentName + " Quiz Results")
- print("---------------------------------------------")
- print("Correct Answers: ",numCorrect)
- print("Incorrect Answers: ",len(numIncorrect),end="")
- if len(numIncorrect) > 0:
- print(" ( ",end="")
- for i in numIncorrect:
- print(i, end="")
- print(")")
- # Comparing results
- if numCorrect >= 11:
- print("\nStudent PASSED the quiz.\n")
- else:
- print("\nStudent FAILED the quiz.\n")
- again = input("\nDo you have another student (y/n)? ")
- if again.lower() == 'n':
- break
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement