class CoffeeMachine:
    def __init__(self, water, coffee_beans, cups):
        self.water = water
        self.coffee_beans = coffee_beans
        self.cups = cups

    def make_coffee(self, coffee_type):
        if coffee_type == "espresso":
            need_water = 50
            need_beans = 20
        elif coffee_type == "americano":
            need_water = 150
            need_beans = 20

        if self.water < need_water:
            print("water가 부족합니다")
            return
        if self.coffee_beans < need_beans:
            print("coffee_beans이 부족합니다")
            return
        if self.cups < 1:
            print("cups이 부족합니다")
            return

        self.water -= need_water
        self.coffee_beans -= need_beans
        self.cups -= 1
        print(f"{coffee_type}가 나왔습니다")



machine = CoffeeMachine(200, 50, 1)
machine.make_coffee("americano")
machine.make_coffee("espresso")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: