TORONTO KIDS COMPUTER CLUB | Friday 16:15 Python Practice – 23.02.24.
21795
post-template-default,single,single-post,postid-21795,single-format-standard,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Friday 16:15 Python Practice – 23.02.24.

28 Feb Friday 16:15 Python Practice – 23.02.24.

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().

No Comments

Sorry, the comment form is closed at this time.