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
你能解释一点请!即时通讯新的蟒蛇,我不明白如何只是增加或有可以解决我的问题 – user1864828
零是布尔错误,所以0或7给7.这就是说,如果你不能使用'if',比使用'或'可以限定作为作弊:) –