Pizza Bot

Click the badge below to run my project in Google Colab:

Open In Colab
 1def bot_pizza():
 2    print("Hello ! Welcome to PizzaKrub :)")
 3    menus = {"Hawaiian $": 5, "Pepperoni $": 4, "Seafood $": 6}
 4    my_cart = {"Hawaiian pcs.": 0, "Pepperoni pcs.": 0, "Seafood pcs.": 0}
 5    cost = 0
 6    while True:
 7        print("What can I help you today?")
 8        action = input("Please choose one [1] Order [2] See the menu [3] Your cart [4] Checkout :")
 9        if action == "1":
10            print("What can I get for you today?")
11            while True:
12                order = input("Please choose one [1] Hawaiian [2] Pepperoni [3] Seafood [4] Back :")
13                if order == "1":
14                    my_cart["Hawaiian pcs."] += 1
15                    cost += menus["Hawaiian $"]
16                    print("Hawaiian pc. added")
17                    break
18                elif order == "2":
19                    my_cart["Pepperoni pcs."] += 1
20                    cost += menus["Pepperoni $"]
21                    print("Pepperoni pc. added")
22                    break
23                elif order == "3":
24                    my_cart["Seafood pcs."] += 1
25                    cost += menus["Seafood $"]
26                    print("Seafood pc. added")
27                    break
28                elif order == "4":
29                    break
30        elif action == "2":
31            print(menus)
32        elif action == "3":
33            print(my_cart)
34            print(f"Total amount : {cost} $")
35            while True:
36                cart_edit = input("Do you want to cancel order? (Y/N): ")
37                if cart_edit == "Y":
38                    print("Which one would you like to cancel?")
39                    remove_order = input("Please choose one [1] Hawaiian [2] Pepperoni [3] Seafood [4] Back :")
40                    if remove_order == "1" and my_cart["Hawaiian pcs."] > 0:
41                        my_cart["Hawaiian pcs."] -= 1
42                        cost -= menus["Hawaiian $"]
43                        print("Hawaiian pc. removed")
44                        print(f"Current cart: {my_cart}, Total: {cost} $")
45                        break
46                    elif remove_order == "2" and my_cart["Pepperoni pcs."] > 0:
47                        my_cart["Pepperoni pcs."] -= 1
48                        cost -= menus["Pepperoni $"]
49                        print("Pepperoni pc. removed")
50                        print(f"Current cart: {my_cart}, Total: {cost} $")
51                        break
52                    elif remove_order == "3" and my_cart["Seafood pcs."] > 0:
53                        my_cart["Seafood pcs."] -= 1
54                        cost -= menus["Seafood $"]
55                        print("Seafood pc. removed")
56                        print(f"Current cart: {my_cart}, Total: {cost} $")
57                        break
58                    elif remove_order == "4":
59                        break
60                elif(cart_edit) == "N":
61                    break
62        elif action == "4":
63            print("----------------------------------------")
64            print("Receipt")
65            print("----------------------------------------")
66            print(f"Hawaiian pcs. : {my_cart['Hawaiian pcs.']}")
67            print(f"Pepperoni pcs. : {my_cart['Pepperoni pcs.']}")
68            print(f"Seafood pcs. : {my_cart['Seafood pcs.']}")
69            print(f"Total amount : {cost}$")
70            print("Thank you for ordering with us :)")
71            print("Enjoy your Pizza and Have a good day!")
72            break
73        else:
74            print("Error! You select the wrong option")
75
76bot_pizza()
77# end of main.py

Comments

Leave a Reply

Discover more from Firn Suchaya

Subscribe now to keep reading and get access to the full archive.

Continue reading