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
Which is considered the best way to secure a laptop to a desk in a workplace?
Lorico [155]

Answer:

Lock it in a safe is the best way to secure a  laptop to a  desk in a work space.

Explanation:

Since the end user feels that a laptop can be stolen or taken by others is a safe way to keep hire or her laptop in a  safe place.

Bolt  it:-  it is  not possible, because there   is  no   option available

Lock  it is safe:- this  is  idle or best  solution is  safe his or her laptop

Use an alarm :- the person   who steals the laptop will be more intelligent and he or she knows how to disable the alarm system.

Use  cable lock;- it is easy to remove it.

3 0
3 years ago
You can get context-sensitive help information from the code editor by
Drupady [299]
Visual Studio* IDE Code Editor.
8 0
3 years ago
1, How can technology serve to promote or restrict human rights? [2 points]
prisoha [69]

Answer:

Examples of how technology can be used as a powerful tool for human rights are ever expanding. Newer technologies such as artificial intelligence, automation, and blockchain have the potential to make significant positive contributions to the promotion and protection of human rights.

7 0
3 years ago
The "Father of the Computer" was _____________, an Englishman, who in 1836 produced designs for a "computer" that could conduct
Leviafan [203]

Answer:

Charles Babbage is the correct answer to the following question.

Explanation:

Charles Babbage is the person who invented the computer, but he failed to build the computer system and the first engine was finished in year 2002 in London, after 153 years of his death but he was an inventor and the father of the automatic computing engines.

So, that's why he was called as the "Father of Computer".

5 0
3 years ago
How is the Microsoft Word 2013 window organized?
Alenkasestr [34]
The answer is (A): with contextual tabs for major groupings of editing features and ribbons with specific groupings to organize commands.


Contextual tab or tabs are hidden menu that appears when objects like images or texts are selected in programs like MS Word 2013. They typically contain one or more commands applicable to a selected text or object only. They are there in the Ribbon when you need them and disappear when you do not need them anymore. They are basically used for major groupings of editing features.
A ribbon on the other hand help users understand how commands are used directly and efficiently. It organizes a program’s features into a series of tabs.




6 0
4 years ago
Read 2 more answers
Other questions:
  • You've been asked to design a soho network on a work place. the other offices in the building also have wireless networks. while
    7·1 answer
  • It is essential for a relay energized by alternating current to have
    13·1 answer
  • Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
    15·1 answer
  • A common method of grouping security risks and security safeguards (controls) is to organize them into logical _________________
    12·1 answer
  • Match the elements of a web page with their description
    15·2 answers
  • Which job qualifications are typical for someone who wants to work in Information Support and Services?
    8·2 answers
  • Helppp plzz ajjsndndbsskdjf​
    11·1 answer
  • Magnetic video tape in a plastic casing is a?
    13·1 answer
  • How many people did you help today
    11·2 answers
  • Your client Mr. Smith has requested a reservation at Eleven Madison Park this evening for a party of 2 at 6PM. Unfortunately, th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!