0
How is% use in python
3 Answers
0
The % (modulo) operator yields the remainder from the division of the first argument by the second. The numeric arguments are first converted to a common type. A zero right argument raises the ZeroDivisionError exception. The arguments may be floating point numbers, e.g., 3.14%0.7 equals 0.34 (since 3.14 equals 4*0.7 + 0.34.) The modulo operator always yields a result with the same sign as its second operand (or zero); the absolute value of the result is strictly smaller than the absolute value of the second operand [2]
0
% is remainder in math for example (3.1%1=0.1) 3.1 is containes 3 ones (1+1+1) and remains 0.1 and (2.5%0.3=0.4) 2.5 containes (7 * 0.3 ) and remains 0.4
0
it can also be used in printing. print("blah blah %s", string) would print blah blah and the value of string. it can also be used for integers and presumably floats and other days types.