Computer Science, asked by neerajagrawal88296, 1 month ago

write program that ask the user the day number in a year in the range 2 to 365 and asked the first day of the year Sunday or Monday or Tuesday etc then the program should display the day on the day
number that has been in it​

Answers

Answered by akshadsingh12
0

Answer:

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])

Explanation:

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])

Answered by prakharagrawal6055
0

Answer:

n=int(input("Enter any day number between 2-365:"))

day=input("Enter the first day of the year (moday,tuseday,etc..):")

dic={1:"Monday",2:"Tuseday",3:"Wednesday",4:"Thrusday",5:"Friday",6:"Saturday",0:"Sunday"}

dic1={"Monday":1,"Tuseday":2,"Wednesday":3,"Thrusday":4,"Friday":5,"Saturday":6,"Sunday":7}

num=dic1[day.capitalize()]

for i in range(n):

   if num==7:

       num=0

   num+=1

print(dic[num-1])

Explanation:

Similar questions