forked from CodeMouse92/DeadSimplePython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern_match.py
More file actions
27 lines (25 loc) · 855 Bytes
/
pattern_match.py
File metadata and controls
27 lines (25 loc) · 855 Bytes
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
class Special:
TODAY = 'lasagna'
lunch_order = input("What would you like for lunch? ")
# if ' ' in lunch_order:
# lunch_order = lunch_order.split(maxsplit=1)
match lunch_order:
case Special.TODAY:
print("Today's special is awesome!")
case 'pizza':
print("Pizza time!")
case 'sandwich':
print("Here's your sandwich")
case 'taco':
print("Taco, taco, TACO, tacotacotaco!")
case 'salad' | 'soup':
print("Eating healthy, eh?")
# case (flavor, 'ice cream'):
# print(f"Here's your very grown-up {flavor}...lunch.")
case ice_cream if 'ice cream' in ice_cream:
flavor = ice_cream.replace('ice cream', '').strip()
print(f"Here's your very grown-up {flavor}...lunch.")
case order:
print(f"Enjoy your {order}.")
# case _:
# print("Yummy.")