-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch case.py
More file actions
40 lines (37 loc) · 985 Bytes
/
Copy pathswitch case.py
File metadata and controls
40 lines (37 loc) · 985 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
# Python 3.10+ ONLY!
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 _: # Default case (like default: in C++)
# if day is not 1, 2, 3, 4, or 5, this block will execute
# its just like else
print("Weekend")
# in c++
# switch (day) {
# case 1:
# cout << "Monday" << endl;
# break;
# case 2:
# cout << "Tuesday" << endl;
# break;
# case 3:
# cout << "Wednesday" << endl;
# break;
# case 4:
# cout << "Thursday" << endl;
# break;
# case 5:
# cout << "Friday" << endl;
# break;
# default:
# cout << "Weekend" << endl;
# }