write a program that asks the user the day number in a year in the range 2 to 365 and asks the first day of the year - Sunday or Monday or Tuesday etc. Then the program should display the day - number that has been input.
Answers
Answered by
5
10 cls
20 INPUT "ENTER ANY RANGE"
20 INPUT "ENTER ANY RANGE"
Answered by
18
Answer:
day = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
x = input("Enter the first day of the year: ")
num = int(input("Enter the number of the day: "))
y = num % 7
if (day.index(x) + y - 1) > 6 and num < 365 :
print("The day of the year is: ", day[day.index(x) - 7 + y])
elif num>365:
print("The number entered is invalid, please enter number from 2 to 365")
else:
print("The day of the year is: ", day[day.index(x) + y - 1])
Similar questions