Reference no: EM132330211
Question
Create a sub class MultiChoiceQuestion to the question hierarchy of Section 10.1 that allows multiple correct choices. The respondent should provide all correct choices, separated by spaces. Provide instructions in the question text.
Below is the program that runs the class MultiChoiceQuestion.py.
# This program shows a simple quiz with one question.
# Create the question and expected answer.
q = MultiChoiceQuestion()
q.setText("Of Apple, Tomato, Carrot, Cucumber and Celery, list all that are fruit.")
q.setAnswer("Apple Tomato")
# Display the question and obtain user's response.
q.display()
response = input("Your answer: ")
print(q.checkAnswer(response))
Note: Responses of "Apple Tomato" or "Tomato Apple" are both correct.