1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ASHA 777 [7]
3 years ago
9

Add a subclass FillInQuestion to the question hierarchy of Section 10.1. Such a question is constructed with a string that conta

ins the answer, surrounded by _ _, for example, "the inventor of Python was _Guido van Rossum_". The question should be displayed as 6 pts
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))
a) Your code with comments
b) A screenshot of the execution
Identify the superclass and subclass in each of the following pairs of classes.
a) Employee, Manager
b) Student, GraduateStudent
c) Employee, Professor
d) Truck, Vehicle
use python to programe this Q and please make sure to include the commenst in the coding and make sure do not copy and past here i saw all the answers here in chegg but not what i want, and show me screenshot of the output
Computers and Technology
1 answer:
sattari [20]3 years ago
3 0

Answer:

class Question:

   def __init__(self):

       self.text = ""

       self.answer = ""

   def setText(self,text):

       self.text = text

   def setAnswer(self,answer):

       self.answer = answer

   def display(self):

       print(self.text)

   def checkAnswer(self,response):

       ans = self.answer.replace(' ','')

       ans = ans.lower()

       response = response.replace(' ','')

       response = response.lower()

       if(response == ans):

           return "Correct answer"

       else:

           return "Wrong answer"

class FillInQuestion (Question):

   def __init__(self):

       super(Question, self).__init__()

   def setText(self,text):

       temp = text.split("_")

       temp[0] = temp[0] + "_______"

       super(FillInQuestion,self).setText(temp[0])

       super(FillInQuestion, self).setAnswer(temp[1])

def main():

   # 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))

main()

Explanation:

The python program defines two classes, a parent class called Question and a child class called FillInQuestion. The screen shot of the output is seen below.

You might be interested in
In general, a presentation to kindergarteners should be less abstract than a presentation to corporate executives
Salsk061 [2.6K]
Make the presentation goofy so they will be more into it . your welcome
4 0
3 years ago
Read 2 more answers
Please explain a function in coding.
Julli [10]

Answer:

it is organized reusable code to perform some action

8 0
3 years ago
How are a members details be checked and verified when they return to log back in to the website ?
aksik [14]

Answer:

When you sign into a website, you have to enter a password and username most of the time, which will allow the website to know that you have checked in and it is you, who is using your account.

6 0
3 years ago
Typically homes ___________ over time and cars ______________ over time.
fomenos
Typically homes erode over time and cars rust over time. 

this is what i believe it is 
4 0
3 years ago
Read 2 more answers
Desinated for a network connection within a largecity or multiple small citys
frozen [14]

I think it is WAN (Wide Area Network).

6 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell the word correctly.
    14·2 answers
  • Alcatel-Lucent’s High Leverage Network (HLN) increases bandwidth and network capabilities while reducing the negative impact on
    6·1 answer
  • How do you access the dark web? What are the negatives of doing this?
    14·1 answer
  • What does the word “Gacha” come from??????
    5·2 answers
  • #Write a function called 'string_type' which accepts one #string argument and determines what type of string it is. # # - If the
    8·1 answer
  • The point of entry from a wireless device to a wired network is performed at a device called a(n) ____________________.
    10·1 answer
  • Does anybody know how to fix my Minecraft??? My character isn’t loading and realms aren’t working?? Look at the picture!
    5·1 answer
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
  • Populate a stack with ten random integers and empty it by showing that the order of the elements is reversed, from last to first
    8·1 answer
  • The banner on the front page of a newsletter that identifies the publication is the:.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!