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]
2 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]2 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
Given a list ` = (x1 x2 . . . xn−1 xn), we define two rotations of the list: The left-rotation is (x2 . . . xn−1 xn x1) and, lik
aleksandrvk [35]

Explanation:

The below code has been written in C language

void rotateright(int list[], int n)

{

  int x = list[n-1]

  int i;

  for (i = n-1; i > 0; i--)

     list[i] = list[i-1];

  list[0] = x;

}

void rotateleft(int list[], int n)

{

  int x = list[0]

  int i;

  for (i = 1; i < n-1 ; i++)

     list[i] = list[i+1];

  list[n-1] = x;

}

int main()

{

   int list[] = {x1, x2, x3, ... x(n-1),xn}

   int i;

   int n = sizeof(list);

       

   rotateright(list, n);

 

   rotateleft(list, n);

   

   return 0;

}

3 0
3 years ago
While working on a forty-slide PowerPoint presentation, a user needs to quickly look over the six slides that have orange backgr
guapka [62]

Answer:

B

Explanation:

8 0
3 years ago
A​ ___________ identifies the content and purpose of the​ visual, along with whatever label and number​ you're using to refer to
Westkost [7]

Answer:Title

Explanation: Title is basically considered as the "heading" or the "topic" that is used for giving the hint about the content or visual. In context with the visual ,which is the piece of display where title determines about the reason of visual and also hints about the content .It also gives the reference number that a person assign to the visual.

7 0
3 years ago
My dog peed in the house last week
Solnce55 [7]

Answer:

my dog chewed up the couch

Explanation:

5 0
3 years ago
Read 2 more answers
Write a program to calculate the
marishachu [46]

Answer:

blep blep blep belp belp belp belp belp belp BELPPPPPPPPPP

5 0
3 years ago
Other questions:
  • When the packet leaves the router, which source and destination ip addresses will be contained in the packet?
    9·1 answer
  • The protocol that enables computers on the Internet to communicate with one another is called _____.
    10·2 answers
  • Electromagnetic waves used in ovens and cell phone communications are called
    6·1 answer
  • Given an int variable k, an int array incompletes that has been declared and initialized, an int variable studentID that has bee
    10·1 answer
  • An extranet is like an intranet except that it allows company employees access to corporate Web sites from the ______
    13·1 answer
  • How to get out of compatibility mode in word?
    15·1 answer
  • __________ is a very simple form of lossless data compression in which runs of data (that is, sequences in which the same data v
    6·1 answer
  • What is the term for the era created by the digital revolution?<br>​
    13·1 answer
  • You are designing an exciting new adventure game and you want to attempt to explain where items that are carried by the player a
    6·1 answer
  • How long will the plant have been dead when 87.5 percent of its C-14 has become N-14?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!