Class Spell(object):
def __init__(self, incantation, name):
self. name = name
self...
Computers and Technology, 08.04.2020 04:28 okokjadee
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.
Answers: 2
Computers and Technology, 22.06.2019 15:10, reycaden
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
Computers and Technology, 23.06.2019 17:20, Morehollie9428
What is the best assassins creed game?
Answers: 2
Computers and Technology, 24.06.2019 16:00, alexisbeasley2
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
Biology, 07.10.2019 21:00
English, 07.10.2019 21:00