-
Notifications
You must be signed in to change notification settings - Fork 0
/
breakfast_bot.py
51 lines (42 loc) · 1.48 KB
/
breakfast_bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import time
def print_pause(message_to_print):
print(message_to_print)
time.sleep(2)
def valid_input(prompt, option1, option2):
while True:
response = input(prompt).lower()
if option1 in response:
break
elif option2 in response:
break
else:
print_pause("Sorry, I don't understand.")
return response
def intro():
print_pause("Hello! I am Bob, the Breakfast Bot.")
print_pause("Today we have two breakfasts available.")
print_pause("The first is waffles with strawberries and whipped cream.")
print_pause("The second is sweet potato pancakes with butter and syrup.")
def get_order():
response = valid_input("Please place your order. "
"Would you like waffles or pancakes?\n",
"waffles", "pancakes")
if "waffles" in response:
print_pause("Waffles it is!")
elif "pancakes" in response:
print_pause("Pancakes it is!")
print_pause("Your order will be ready shortly.")
def order_again():
response = valid_input("Would you like to place another order? "
"Please say 'yes' or 'no'.\n",
"yes", "no")
if "no" in response:
print_pause("OK, goodbye!")
elif "yes" in response:
print_pause("Very good, I'm happy to take another order.")
get_order()
def order_breakfast():
intro()
get_order()
order_again()
order_breakfast()