Answer to Question #297756 in Python for sruthi

Question #297756

days= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

a= input()

b = int(input())

i = b % 7 -1 

if a in days:

  d = days.index(a)+i

if d >= 7:

  d = d - 7

print(days[d-1])

this code is not working

how to print days


1
Expert's answer
2022-02-14T12:05:03-0500
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

# Output of all days
for day in days:
    print(day)

# Output day by index
d_index = int(input('Enter day index: '))
print(days[d_index%7-1])

#In the future, if you want to get a more accurate answer to the broken code,
#attach descriptions of the task that the code should perform.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS