+ 10
What is the difference between Forward Slash ' / ' and Modulo ' % ' ? (Pyhton Language)
I've found that the output of operation with both Forward Slash ' / ' and Modulo ' % ' have the same function which will produce floats. But why they are different? I still don't get the meaning. Somebody please help me to find out the answer
11 Respuestas
+ 6
/ is for division purpose while % is used to find reminder.
+ 3
forward' / ' will give the quotient of operation
modulo will give the reminder of operation
for example 10/2 = 5
10%2=0(gives reminder)
+ 2
/ is used to get quotient.
% is used to get remainder
+ 1
initially % i thought this is percentage..damn ;)
+ 1
/ is for division whereas % is mod operator which gives remainder..
+ 1
Forward slash(/) gives the answer in float, while modulo(%) divides and gives the remainder.
0
To determine the quotient and remainder of a division, use the floor division and modulo operators, respectively.
Floor division is done using two forward slashes.
The modulo operator is carried out with a percent symbol (%).
0
Hi frnd one equvation 25%3:
25 dividing 3 for
6*4= 24
Also
25-24=1
The remaining for 1
This remaining is 1for answer the question and this modulus ok
Another slash '/'
Single slash is dividing ok
An double slash is 20//6
6*3=18
20/6=3
20/6=3
3+3=6
6/3=3
Answer is 3
- 5
'/' is used to get remainder
'%'is used to get quotient