1024 / 42 , 1024 // 42 , 1024 % 42 what is the difference between them? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuesta
+ 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