What is the difference between Subtract and modulo


#1

spam = 150%99
print spam
51

spam = 150-99
print spam
51


#2

the modulo operator gives the remainder after division:

print 17 % 3 # 2

if we look at subtract:

print 17 - 3 # 14

of course, there are values which give the same result, but there are few, and this operators work very differently


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.