Free Friday 2/6/2026


To day I learned, using youtube, how to make a coffee app.

class Coffee:

    # initiale coffee with name and price

    def __init__(self, name, price):

        self.name = name
        self.price = price


class Order:

    # initiale order with empty list

    def __init__(self):

        self.items = []

    # add coffee to order

    def add_item(self, coffee):

        self.items.append(coffee)

        print(f"Added {coffee.name} tp your order")

        # calculate total price

        def total(self):

            return sum(item.price for item in self.items)
        
        # show summary

        def show_order(self):

            if not self.items:

                print("No items in order.")

                return
            
            print("\nYour Order:")

Leave a Reply

Your email address will not be published. Required fields are marked *