-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatch.py
More file actions
51 lines (37 loc) · 961 Bytes
/
Match.py
File metadata and controls
51 lines (37 loc) · 961 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
print("############MATCH:######################")
DAY = 3
match DAY:
case 1:
print("MONDAY")
case 2:
print("TUESDAY")
case 3:
print("WEDNESDAY")
case 4:
print("THURSDAY")
case 5:
print("FRIDAY")
case 6:
print("SATURDAY")
case 7:
print("SUNDAY")
case _: # default block if nothing matches
print("Looking forward to the Weekend")
print("#######Combine Values ##########")
print("*****Use the pipe character | as an or operator in the case evaluation to check for more than one value match in one****")
day = 3
match day:
case 1 | 2 | 3 | 4 | 5:
print("Its a week day..")
case 6 | 7:
print("Its a weeked..")
print("#######If Statements as Guards##########")
month = 5
day = 4
match day:
case 1 | 2 | 3 | 4 | 5 if month == 4:
print("A weekday in April")
case 1 | 2 | 3 | 4 | 5 if month == 5:
print("A weekday in May")
case _:
print("No match")