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
Explain briefly in What Way, Facebook is not free medium
Sergio039 [100]
"If you're not paying for it, you are the product."
Your information and (buzzword warning) "big data" are being collected and potentially sold in ways that you cannot control.
4 0
3 years ago
Jenna received an interesting email about dolphins that she wants to share with her brother. Which operation will allow Jenna to
KATRIN_1 [288]
The answer is Forward

5 0
3 years ago
2. Choose all of the correct answers for each of the following: [a] The relations of two sub-entity sets of the same super entit
Andrews [41]

Answer:

i say b

Explanation:

5 0
2 years ago
WikiLeaks is a famous not-for-profit whistleblower website. MasterCard and Visa stopped payments to WikiLeaks after a series of
gayaneshka [121]

Answer:

Hacktivists

Explanation:

Hacktivists are individuals who gain unauthorized access to computer networks or information, then use unruly ways to effect social or political change. Hacktivism started as a way of protesting online to effect a change by pushing for a certain outcome. This saw the building of websites such as wiki leaks. Although hacktivists are not entirely driven by malicious intent they employ some tactics used by hackers to drive their message across.

5 0
3 years ago
Which of the following is planted on an infected system and deployed at a predetermined time?A. Logic bombB. Trojan horseC. Worm
nekit [7.7K]

Answer:

A. Logic Bomb.

Explanation:

A Logic Bomb is a piece of code that is planted in a software system that is infected intentionally to set off malicious function.They are deployed at a predetermined time.

For ex:- a programmer hiding the files that deletes details of the employee who left the company.So these files can never be deleted.

4 0
3 years ago
Other questions:
  • Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Car
    13·1 answer
  • Given the following classes and their objects:
    11·1 answer
  • You want to create a directory called ~/Documents/papers, but you’re not sure that the ~/Documents directory exists. What comman
    15·1 answer
  • Name types of operating system with example
    5·1 answer
  • To create a public key signature, you would use the ______ key.
    5·1 answer
  • What is the full form of RAM. ​
    5·2 answers
  • in java Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, o
    13·1 answer
  • Select all the sets that are countably infinite. Question 3 options: the set of real numbers between 0.1 and 0.2 the set of all
    12·1 answer
  • I NEED HELP!!! BRAINLIEST!!!
    14·2 answers
  • In one to two sentences, describe how you would create a border around a group of cells.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!