1024 / 42 , 1024 // 42 , 1024 % 42 what is the difference between them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Sep 2021, 3:55 PM
Naveen Gowda CG
1 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
13th Sep 2021, 4:03 PM
Simon Sauter
Simon Sauter - avatar