+ 7

# Meaning of //

5//2

18 ответов

+ 11

Floor division

+ 9

5/2=2.5 ------->Simple division
5//2=2. 0--------->The quotient of the division is the result.
5%2=1 --------->The rest of the division is the result.

+ 6

I think that this question has also been asked multiple times so if you had searched you would have found the answer that way too.

+ 5

That's the floor division.
5 // 2 = int(5 / 2) = 2

+ 4

Run this in your IDE.
a = 5/2 # 2.5
print(a, type(a))
b = 5//2 # 2..... as the .5 is removed
print(b, type(b))

+ 3

// is floor division. It will divide the first number by the second number but will round it down if it is not an integer. It does the same as int(5/2), where it does 5/2 but forces it to become an integer. And as I'm sure you know, integers can only be whole numbers. Therefore, 5//2=int(5/2)=2, but 5/2=2.5. I hope this helps! :D

+ 2

// is floor division, meaning after division it will round the number down always rather than up

+ 2

Floor division...ie. returns only the quotient part

+ 1

// it means floor division (will only give the main value in a decimal

+ 1

it is floor division
example:
9//8
1.0

+ 1

it means floor division
5/2 =2.5
5//2 =2
the decimals is removed

+ 1

Floor division
,the decimal is removed after division

+ 1

floor division is a division with integer result

+ 1

for example
lets take a number 10, when we divide it with 4 the quotient will come 2.
so, basically meaning of // is the quotient that comes after dividing a number.
similarly 5//2 will result in 2.

0

x // y = int(x - (x/y))

0