0

is super().__init__(name, cuisine_type) line required by programs works without it

Question:An ice cream stand is a specific kind of restaurant. Write a class called IceCreamStand that inherits from the Restaurant class you wrote in Exercise 9-1 (page 166) or Exercise 9-4 (page 171). Eitehr version of the class will work; just pick the one you like better. Add an attribute called flavors that stores a list of ice cream flavors. Write a method that displays theese flavors. Create an instance of IceCreamStand, and call this method. class Restaurant(): """A class representing a restaurant.""" def __init__(self, name, cuisine_type): """Initialize the restaurant.""" self.name = name.title() self.cuisine_type = cuisine_type self.number_served = 0 def describe_restaurant(self): """Display a summary of the restaurant.""" msg = self.name + " serves wonderful " + self.cuisine_type + "." print("\n" + msg) def open_restaurant(self): """Display a message that the restaurant is open.""" msg = self.name + " is open. Come on in!" print("\n" + msg) def set_number_served(self, number_served): """Allow user to set the number of customers that have been served.""" self.number_served = number_served def increment_number_served(self, additional_served): """Allow user to increment the number of customers served.""" self.number_served += additional_served class IceCreamStand(Restaurant): """Represent an ice cream stand.""" def __init__(self, name, cuisine_type='ice_cream'): """Initialize an ice cream stand.""" super().__init__(name, cuisine_type) self.flavors = [] def show_flavors(self): """Display the flavors available.""" print("\nWe have the following flavors available:") for flavor in self.flavors: print("- " + flavor.title()) big_one = IceCreamStand('The Big One') big_one.flavors = ['vanilla', 'chocolate', 'black cherry'] big_one.describe_re

4th Mar 2021, 6:41 AM
MUDIT JAIN
MUDIT JAIN - avatar
5 Respuestas
0
Mirielle[ INACTIVE ] why do we have to call the base class constructor
4th Mar 2021, 8:21 AM
MUDIT JAIN
MUDIT JAIN - avatar
0
Superb
4th Mar 2021, 9:23 AM
MUDIT JAIN
MUDIT JAIN - avatar
4th Mar 2021, 9:27 AM
MUDIT JAIN
MUDIT JAIN - avatar