Modulo


#1

I don't know what I'm doing wrong
spam = 1= 45- 56 =10%


#2

Hi,

You need something that looks like this:

spam = 15 % 3

This will set spam to 0 because 15 is divisible by 3.

For any two numbers a and b, a % b gives you the remainder of deviding a by b.

10% is not a valid expression because you need a number to the left and to the right of the % operator.
Assignments like:

spam = 1 = 10 / 1

are not allowed. In this case Python would try to do the rightmost assignment first, so it would try to assign the value of the expression 10 / 1, to 1 but you can not assign new values to literals (like 1).

I think the first answer here explains it well: http://stackoverflow.com/questions/18716564/python-cant-assign-to-literal