Quotient and Remainder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Quotient and Remainder

I dont understand this ">>> 20 // 6 3 >>> 1.25 % 0.5 0.25" Can anyone explain it to me? Sorry i'm newbie, i don't understand this:(

18th Apr 2020, 3:26 AM
Syakirin Ooi
Syakirin Ooi - avatar
2 Answers
+ 1
In python "//" is called as floor division.. It's work is to result quotient of integer format ie., it removes the decimal part of quotient and gives the result... Here, 20//6 is 3 (perform manually once you'll get an idea) The nest one "%" is called as modulo operator... It's work is to give remainder of the operation... Here, 1.25 % 0.5 results in 0.25 (once do it manually)... https://www.google.com/amp/s/blog.tecladocode.com/pythons-modulo-operator-and-floor-division/amp/ If you dont get any idea... Go through the above link once.. Hope you understand 👍
18th Apr 2020, 3:45 AM
sarada lakshmi
sarada lakshmi - avatar
+ 2
Thank you sarada lakshmi , i understand now:)
18th Apr 2020, 4:06 AM
Syakirin Ooi
Syakirin Ooi - avatar