10 Apr Monday 19:00 Python Practice – 23.04.10
Question:
Define a class called Lunch. Its __init__() method should have two arguments: self and menu. Where menu is a string. Add a method called menu_price. It will involve a if statement:
- – if “menu 1” print(“Your choice:”, menu, “Price 12.00”)
- – if “menu 2” print(“Your choice:”, menu, “Price 13.40”)
- – else print(“Error in menu”)
To check if it works define: paul = Lunch(“menu 1”) and call paul.menu_price().
Sorry, the comment form is closed at this time.