+ 1
what is this symbol -> (%) for in python?
And, could you please give me an example :)
5 Answers
+ 7
% symbol stands for modulus
For eg 7%3
3 | 7 | 2
- 6
---------------
1
---------------
Your remainder is 1.
So the final answer is 1 Because 1 is left when we divided 7 by 3
+ 1
This symbol is used to get the remainder when a number divides by another.
Input:
print(5%3)
Output:
2
Because 2 is left remainder on dividing 5 by 3
+ 1
NiLesh[đŽ] thanks! I got it now! It's very helpful! âșđ
+ 1
AKSHAY thanks! It's very helpful! âșđ
+ 1
Jan Markus Thank you! Gonna check that link! âșđ