def get_weekday(d1, d2):
''' (int, int) -> int
The first parameter indicates the current day of the week, and is in the
range 1-7. The second parameter indicates a number of days from the current
day, and that could be any integer, including a negative integer. Return
which day of the week it will be that many days from the current day.
>>> get_weekday(0,14)
7
>>> get_weekday(0,15)
1
'''
weekday = (d1+d2) % 7
if weekday == 0:
weekday = 7
return weekday
Как я могу решить это без использования оператора if?без использования заявления IF
кстати, воскресенье является 1, понедельник 2, .... СБ 7
вы могли бы объяснить немного больше PLS! я новичок в python, я не понимаю, как просто добавить или может решить мою проблему. – user1864828
zero is boolean false, поэтому 0 или 7 дает 7. Если вы не можете использовать 'if', чем использовать' or', можете квалифицировать как обман :) –