Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2020 04:22
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
def numberedDay(firstDay, dayNumber):
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
firstIndex = days.index(firstDay)
endIndex = (firstIndex + int(dayNumber) - 1) % 7
return days[endIndex]
year = input("Year: ")
firstDay = input("First day of the year (e.g. 'Monday'): ")
dayNumber = input("Day number: ")
if dayNumber not in range(2,366):
print(numberedDay(firstDay, dayNumber))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment