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, 21.06.2019 20:40
Convert and simplify the following sentences to conjunctive normal form (cnf): (a) (p → (q → r)) → (p → (r → q)) (b) (p ∧ q) → (¬p ↔ q) (c) ((p → q) ∧ ¬q) → ¬p
Answers: 3
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
Computers and Technology, 24.06.2019 17:30
Match the following. 1. formatting that is applied when cell data meets certain criteria 2. borders with formats not found on the border tool 3. a shortcut bar that contains tools for commonly used formats 4. formats that can be applied to numbers conditional formatting custom borders format bar number formats
Answers: 3
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
Mathematics, 19.03.2021 01:20
Mathematics, 19.03.2021 01:20
Engineering, 19.03.2021 01:20
Spanish, 19.03.2021 01:20
Mathematics, 19.03.2021 01:20
Spanish, 19.03.2021 01:20
Mathematics, 19.03.2021 01:20