#workday progress and back step in weekend
dayfactor = 0.01
total_progress = 1
for i in range(365):
if i % 7 == 6 or 0:
total_progress *= 1-dayfactor
else:
total_progress *= 1+dayfactor
print("the total progress in a year is {:.2f}".format(total_progress))
The result of this code is total_progress = 13.35
but when I change if i % 7 == 6 or 0
into if i % 7 in [6,0]
which I suppose the code will show me the same result, but the total_progress
changed to 4.63
.
Is there any difference between this two codes?