1024 / 42 , 1024 // 42 , 1024 % 42 what is the difference between them? | Sololearn: Learn to code for FREE!

0

1024 / 42 , 1024 // 42 , 1024 % 42 what is the difference between them?

?? Can anyone explain https://code.sololearn.com/cbALfqNk4Lz6/?ref=app https://code.sololearn.com/cbALfqNk4Lz6/?ref=app

9/13/2021 3:55:48 PM

Naveen Gowda CG

1 Answer

New Answer

+4

"/" is for normal division and returns a float. "//" is for floor division. It only gives you the whole number as an integer. It drops the decimals. "%" is the modulo operator it returns the remainder. Example: 9 / 6 = 1.5 9 // 6 = 1 9 % 6 = 3 And for the future https://code.sololearn.com/W3uiji9X28C1/?ref=app