4 Using Modulo for Extra Credit


I didn't see this posted in here and I had an evening to think about this and you do get to read some very interesting stuff about floating points and python in doing this.

% 10 gives you the right most digit since that digit is the remainder when you divide a number by 10. Then subtract the remainder from the original number, divide by 10 and continue until the number is 0.


Tht looks good, but if you didn't otice that your variable sum is colored vs. the other variable's name. That is because you are using a protected namespace as your variable. In this case it is sum() you want to avoid overriding a namespace, unless you explicitly want to override it that is.


Thanks zeziba. Fixed it and reposted it in place.