Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class Spell: def __init__(self, incantation, name): self.name = name self.incantation = incantation def_str_(self): return self.name +''+ self.incantation + ' ' + self.get_description() def get_description(self): return

image text in transcribed
image text in transcribed
class Spell: def __init__(self, incantation, name): self.name = name self.incantation = incantation def_str_(self): return self.name +''+ self.incantation + ' ' + self.get_description() def get_description(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 get_description(self): return 'Causes the victim to become confused and befuddled! def study_spell(spell): print spell spell = Accio() spell.execute() study_spell(spell) study_spell(Confundo()) Answer the following questions: 1. What are the parent and child classes here? 2. What are the base and sub-classes? 3. What is the output from this code? Try without running if you can 4. When study_spell(Confundo()) executes...what get_description method gets called and why? 5. The statement print Accio() needs to print 'This charm summons an object to the caster, potentially over a significant distance')? Write down the code that we need to add and/or change

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

What is Larmors formula? Explain with a suitable example.

Answered: 1 week ago