Kodewick
Start learning →
Starter←→0 / 80

Burger price

#056StarterClassesConditions3 min

At the burger bar each patty is 8, and cheese (cheese is True) adds 3. Burger already stores the patties and the cheese choice. Finish the method price() so it returns what this burger costs.

Examples
burger_price(2, False)→16
burger_price(1, True)→11
main.py
class Burger:
    def __init__(self, patties, cheese):
        self.patties = patties
        self.cheese = cheese

    def price(self):
        # your code here: work out the price from the patties and cheese, then return it (instead of return 0)
        return 0


def burger_price(patties, cheese):
    order = Burger(patties, cheese)
    return order.price()
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.