subject

Class Spell(object):
def __init__(self, incantation, name):
self. name = name
self. incantation = incantation

def __str__(self):
return self. name + ' ' + self. incantation + '\n' + self. getDescription()

def getDescription(self):
return 'No description'

def execute(self):
print self. incantation

class Accio(Spell):
def __init__(self):
Spell.__init__(self, 'Accio', 'Summoning Charm')

class Confundo(Spell):
def __init__(self):
Spell.__init__(self, 'Confundo', 'Confundus Charm')

def getDescription(self)
return 'Causes the victim to become confused and befuddled.'

def studySpell(spell):
print spell

spell = Accio()
spell. execute()
studySpell(spell)
studySpell(Confundo())
Based on the Python code given above, answer the following questions:

a) Which are the parent and child classes here?

b) What is the output of the code? (Try figuring it out without running it)

c) Which get_description() method is called when the ‘study spell(Confundo())’ function

is executed? Why?

d) What do we need to do so that that statement print(Accio()) will print the

description ‘This charm summons an object to the caster, potentially over a significant distance’? Write down the code that needs to be added or changed.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
question
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
"gps interaction and cognitive process" respond to the following: imagine that you have been asked to design a gps product that will have voice recognition and bluetooth capability. discuss and conceptualize a user interaction model. predict two (2) problems that may arise in gps products with voice recognition and bluetooth capability. recommend solutions for each of these issues. attention is one of the six cognition processes. when attention is applied to a design, the goal is to make it easier for the end user to quickly locate where he / she should type information on the computer or mobile device screen. compare and contrast how the google search engine and the microsoft bing search engine employ the attention cognition process. provide your opinion as to which search engine better employs the attention cognition process and explain why.
Answers: 3
You know the right answer?
Class Spell(object):
def __init__(self, incantation, name):
self. name = name
self...
Questions
question
Mathematics, 30.04.2021 14:00
question
Biology, 30.04.2021 14:00
question
English, 30.04.2021 14:00
question
Mathematics, 30.04.2021 14:00
question
Mathematics, 30.04.2021 14:00
Questions on the website: 13722367