Answer to Question #91995 in Python for M. JESH KUMAR

Question #91995
Write a function that takes two parameters (days_count:int, current_day: str)
where the current_day is anything from ["sun", "mon", "tue", "wed", "thur", "fri", "sat"]
and returns the day that occurs after the number of days_count


defget_day(days_count, current_day):
# your code here


return
example:
get_day(3, "mon") # result --------> "thur"
get_day(10, "wed") # result --------> "sat"
1
Expert's answer
2019-07-25T15:16:12-0400
def get_day(days_count, current_day):
    week_days = ['sun', 'mon', 'tue', 'wed', 'thur', 'fri', 'sat']
    expected_day_index = week_days.index(current_day)
    
    while days_count != 0:
        expected_day_index += 1
        days_count -= 1
        
        if expected_day_index > 6: 
            expected_day_index = 0

    return week_days[expected_day_index]

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

Assignment Expert
26.07.19, 17:10

Yes, it is engine bug, will be fixed soon.

jhan
26.07.19, 12:30

if expected_day_index > 6: expected_day_index = 0 i am not getting wat is that gt in if condition

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS