Ok then similarly to c here % produces remainder but using // 2 times we get quotient | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Ok then similarly to c here % produces remainder but using // 2 times we get quotient

is that correct

26th May 2017, 8:58 AM
K Sai
K Sai - avatar
2 Answers
+ 13
// This operation is known as floor division (gives the quotient as whole number) / gives the quotient as float form % gives remainder 5/2 is 2.5 5//2 is 2 5%2 is 1
26th May 2017, 9:56 AM
Shamima Yasmin
Shamima Yasmin - avatar
0
Every integer can be written in the form of n = p*q + r where p is a positive integer, q is an integer and r < |q| (absolute value). When doing n % q the answer is r, when doing n // q the answer is p. So n == (n // q)*q + (n % q) will return true.
26th May 2017, 9:53 AM
Madera Oxidada
Madera Oxidada - avatar