Why (5//2)=2 | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Why (5//2)=2

Help me plese

1st Aug 2019, 6:01 AM
Durkheim
Durkheim - avatar
4 Réponses
+ 6
There are 3 division operators: /-division //-floor division %-modulus 5/2==2 with a remainder of 1 5//2==2 (leaving out remainder) 5%2==1(the remainder)
1st Aug 2019, 6:18 AM
Helena
Helena - avatar
+ 4
// is integer division Using / will turn it into float by default in python 10 / 2 = 5.0 10 // 2 = 5
1st Aug 2019, 6:16 AM
HNNX ūüźŅ
HNNX ūüźŅ - avatar
1st Aug 2019, 6:11 AM
$hardul B
$hardul B - avatar
+ 3
// is the Python operator for integer or floor division. In C for example you would use / with integer arguments.
1st Aug 2019, 6:59 AM
Sonic
Sonic - avatar