+ 1
I can't solve it 1.25%.5 and i don't understand what is mean !
4 Answers
+ 17
% returns the remainder
//operand on both side can be integer as well as double
1.25%.5 = .25
//as 1.25 = 2*(.5)+.25
+ 5
In python operands can be with decimals also... Anyway:
c= a%b
c= a- (a//b)
In words module is equals to difference from first operand and integer resulted by division of a and b
P.S. Warn that module for negative operands can be implemented in different way plus different languages can implements differently (or not implements at all)
+ 4
1.25= .5*2(=1)+.25
hence,
1.25 divided by .5, quotient is 2 and .25 isn't divided by .5 so it is remainder.
above term is expressed by modulus sign (%),where % shows only remainder,not shows quotient.
it is expressed by
5%2 = 1
11%4 = 3
5%3 = 2
3%5 = 3
6%5 = 1
12%7 = 5
2%2 = 0
1.25%.5 = .25
+ 1
the% symbol in python means the remainder
as 1.25 is in the first and .5 in the second
1.25 has to be divided by .5
so when it is divided the quotient us 2 and the remainder is .25
as % tells us the remainder it will tell us the output as
.25