Q1
Using the class Vehicles defined below:
You can start by:
# define the Vehicle class
class Vehicle:
def init (self, k, c):
self.kind = k self.color = c
# create car1 and car2 here
# print color and kind for car1 and car2 using 2 separate print statements
Desired Output: red convertible blue van
Q2
Using the class Vehicles defined below:
You can start by:
# define the Vehicle class
class Vehicle:
def init (self, k, c):
self.kind = k self.color = c
# add price here # Add method here
# create Fer here
# print description and price for Fer using a print statement
Desired Output
red convertible 60000
Inheritance Exercise:
You can start by:
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'
class Accio(Spell):
def init (self):
Spell.init (self, 'Accio', 'Summoning Charm') # Add your code here
print(Accio())
Desired Output
Summoning Charm Accio
This charm summons an object to the caster, potentially over a significant distance.
This assignment has been answered 2 times in private sessions.
© 2024 Codify Tutor. All rights reserved