find all the errors in the following code and explain what they are and how to c
ID: 3780218 • Letter: F
Question
find all the errors in the following code and explain what they are and how to correct them
CSI 100 Debugging Lab #2 Problem 2: Quiz Program Instructions For this problem you need to debug a method called askQuestion which is supposed to ask a single question in a quiz game. There are both runtime errors and logic errors The function askQuestion is supposed to do all these things in this order: 1. Print the question's prompt 2. print the words "Answer Choices II 3. print each of the answer choices in a numbered list For the sake of human users this list should start with 1 not with 0. 4. ask user to type the number of their choice. Use a input checking loop to keep asking them to try again if the number they type isn't a valid answer number 5. tell the user if they got the question right or Wrong 6. return 0 if the got it wrong, and 1 if they got it right Ask a quiz question Inputs prompt the text of the question answers a list of possible answers correct answer index which one of the answers is right Returns if the user gets the question wrong if the user gets the question rightExplanation / Answer
Error 1) n = len(answers)
== is used for comparison where as = for assignment
Error 2) if choice > 0 and choice < n:
otherwise we will ask for input again for valid input and continue for invalid input.
Error 3) return 0
return is spelled bad.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.