Home > other >  Super () __init__ () where is wrong? Everyone a great god can help take a look at it?
Super () __init__ () where is wrong? Everyone a great god can help take a look at it?

Time:10-04

Class Restaurant () :
"" "go in the name of the restaurant and cusine type of the restaurant "" "
Def __init__ (self, restaurant_name cuisine_type) :
"" "the initialize the attribute of the name and cuisine type "" "
Self. Restaurant_name=restaurant_name
Self. Cuisine_type=cuisine_type
Self. Number_served=0
Def describe_restaurant (self) :
Print (self. Restaurant_name. Title () + "focus on"
+ self. Cuisine_type. Title () + "")
Def open_restaurant (self) :
Print (self. Restaurant_name + "is opening!" )
Def served_number (self) :
Print (self. Restaurant_name. Title () + "from the"
+ STR (self. Number_served) + "people served ()")

The class IceCreamStand (Restaurant) :
"" "" "a special restaurant"

Def __init__ (self, restaurant_name cuisine_type='ice cream) :
"" "the initialize the attribute "" "
Super () __init__ (restaurant_name, cuisine_type) ( can't run, card here)
Self. Flavors=[]
Def show_flavors (self) :
Print (" \ nWe have the following flavor of ice creams: ")
For flavor in the self. Flavors:
Print (" - "+ flavor. The title ())


Smaller_one=IceCreamStand (' dairy queen ')
Smaller_one. Flavors=[' vanilla ', 'strewberry', 'plain', 'chocolate', 'oreo']
Print (smaller_one. Describe_restaurant ())
Print (smaller_one. Open_restaurant ())
Print (smaller_one. Served_number ())
Smaller_one. Show_flavors ()

CodePudding user response:

Use is python3.8, sublime does text
  • Related