-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathEX4.5.py
41 lines (37 loc) · 915 Bytes
/
EX4.5.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
# (Find future dates) Write a program that prompts the user to enter an integer for
# today’s day of the week (Sunday is 0, Monday is 1, ..., and Saturday is 6). Also
# prompt the user to enter the number of days after today for a future day and display
# the future day of the week.
d = eval(input("Enter today's day: "))
n = eval(input("Enter the number of days elapsed since today: "))
res = (n + d) % 7
x = ""
if res == 0:
x = "Sunday"
elif res == 1:
x = "Monday"
elif res == 2:
x = "Tuesday"
elif res == 3:
x = "Wednesday"
elif res == 4:
x = "Thursday"
elif res == 5:
x = "Friday"
elif res == 6:
x = "Saturday"
if d == 0:
d = "Sunday"
elif d == 1:
d = "Monday"
elif d == 2:
d = "Tuesday"
elif d == 3:
d = "Wednesday"
elif d == 4:
d = "Thursday"
elif d == 5:
d = "Friday"
elif d == 6:
d = "Saturday"
print("Today is", d, "and the future day is", x)