-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathchatty bot.py
More file actions
94 lines (81 loc) · 2.67 KB
/
chatty bot.py
File metadata and controls
94 lines (81 loc) · 2.67 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def print_message():
print ("I'm sorry, I did not understand your selection. Please enter the corresponding letter for your response.")
def extra_options():
res = input('Do you want a mug for here, a cup to-go, or a refill of your own cup? \n[a] I\'ll have it here in a mug. \n[b] I ll take a plastic cup to go! \n[c] I brought my own! > ').lower()
if res == 'a':
print('Awesome! Your order will be ready in a mug soon!')
elif res == 'b':
print('Okay, no problem! We\'ll get you a plastic cup.')
elif res == 'c':
print('Great! We\'ll fill up your reusable cup.')
else:
print_message()
return extra_options()
def get_drink_type():
res = input("What type of drink would you like? \n[a] Brewed Coffee \n[b] Mocha \n[c] Latte \n>").lower()
if res == 'a':
return 'brewed coffee'
elif res == 'b':
return 'mocha'
elif res == 'c':
return order_latte()
else:
print_message()
return get_drink_type()
def order_latte():
milk = input("And what kind of milk for your latte? \n[a] 2% milk \n[b] Non-fat milk \n[c] Soy milk \n[d] Almond milk \n[e] Oatmilk \n[f] Hemp milk>").lower()
if milk == 'a':
return 'latte'
elif milk == 'b':
return 'non-fat latte'
elif milk == 'c':
return 'soy latte'
elif milk == 'd':
return 'almond latte'
elif milk == 'e':
return 'oat latte'
elif milk == 'f':
return 'hemp latte'
else:
print_message()
return order_latte()
def extra_options():
res = input('Would you like a plastic cup or did you bring your own reusable cup? \n[a] I\'ll need a cup. \n[b] Brought my own! \n> ')
if res == 'a':
print('Okay, no problem! We\'ll get you a plastic cup.')
elif res == 'b':
print('Great! We\'ll fill up your reusable cup.')
else:
print_message()
return extra_options()
def get_drink_type():
res = input("What type of drink would you like? \n[a] Brewed Coffee \n[b] Mocha \n[c] Latte \n>").lower()
if res == 'a':
return 'brewed coffee'
elif res == 'b':
return 'mocha'
elif res == 'c':
return order_latte()
else:
print_message()
return get_drink_type()
def get_size():
res = input('What size drink can I get for you? \n[a] Small \n[b] Medium \n[c] Large \n> ').lower()
if res == 'a':
return 'small'
elif res == 'b':
return 'medium'
elif res == 'c':
return 'large'
else:
print_message()
return get_size()
def coffee_bot():
print("Welcome to the cafe!")
size = get_size()
drink_type = get_drink_type()
print("Alright, that's a {} {}.".format(size, drink_type))
extra_options()
name = input("Can I get your name please?")
print("Thanks, {}! Your drink will be ready shortly".format(name))
coffee_bot()