Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN PYTHON Add a class FillInQuestion to the following code. Such a question is c

ID: 3696912 • Letter: I

Question

IN PYTHON Add a class FillInQuestion to the following code. Such a question is constructed with a string that contains the answer, surrounded by _ _, for example, “the inventor of Python was _Guido van Rossum_”. The question should be displayed as The inventor of Python was _______ Below is the program that runs the modified class Question: ## # Demonstrate the FillInQuestion class. # # Create the question and expected answer. q = FillInQuestion() q.setText("The inventor of Python was _Guido van Rossum_") # Display the question and obtain user's response. q.display() response = input("Your answer: ") print(q.checkAnswer(response))

class Question :

def __init__(self) :
self._text = ""
self._answer = ""

def setText(self, questionText)
self._text = questionText
  
def setAnswer(self, correctResponse) :
self._answer = correctResponse
  
def checkAnswer(self, response):
return response == self._answer
  
def display(self):
print(self._text)

##############################################

Below is the program that runs the modified class Question:

##

# Demonstrate the FillInQuestion class.

#

# Create the question and expected answer.

q = FillInQuestion()

q.setText("The inventor of Python was _Guido van Rossum_")

# Display the question and obtain user's response.

q.display()

response = input("Your answer: ")

print(q.checkAnswer(response))

Explanation / Answer

# # Create the question and expected answer

def __init__(self) :
self._text = ""
self._answer = ""

def setText(self, questionText)
self._text = questionText
  
def setAnswer(self, correctResponse) :
self._answer = correctResponse
  
def checkAnswer(self, response):
return response == self._answer
  
def display(self):
print(self._text)