+ 2
How can I loop among certain numbers even if they are added or subtracted?
For example: the limit of my number_list is 6. now if I add 5 to 3, the answer shouldn't be 8, but instead, it should be 1. 5 should be added in this way to three; 3 (add 1)= 4(add 1) = 5(add 1)= 6 (add 1) = 0(add 1) = 1
3 Réponses
+ 8
x=3
for i in range(5):
x= (x+1)%7
print(x)
+ 2
a = int(input("number to add"))
x = 1
if x + a > 6:
x = 1
print(x)
else:
x = x + a
print(x)
change x to 0 if u want lowest to be 0