What is the result of % in Python?
What does the % in a calculation? I can’t seem to work out what it does.
What does the % in a calculation? I can’t seem to work out what it does.
I need to test whether each number from 1 to 1000 is a multiple of 3 or a multiple of 5. The way I thought I’d do this would be to divide the number by 3, and if the result is an integer then it would be a multiple of 3. Same with 5.
In the tutorial there is an example for finding prime numbers:
Can anyone explain how the modulo operator works in Python?
I cannot understand why 3.5 % 0.1 = 0.1.
I have found that the same mod operation produces different results depending on what language is being used.
Questions arise when I type in these expressions to Python 3.3.0