How does // works | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does // works

16th Dec 2016, 3:42 PM
U RAY
U RAY - avatar
4 Answers
+ 2
// is floor division. You do division and after that you remove digits after the decimal point. For example: 9/2 gives 4.5 and 9//2 gives 4. Be carful when you when you devide negative number, because floor goes towards negative infinity. Fo example -9//2 gives -5.
16th Dec 2016, 3:50 PM
Majstor_Gile
Majstor_Gile - avatar
+ 1
x//y is like math.floor(x/y)
16th Dec 2016, 3:53 PM
Majstor_Gile
Majstor_Gile - avatar
0
could you tell something more about negative division in python
16th Dec 2016, 3:53 PM
U RAY
U RAY - avatar
0
It is same basic math rules.
20th Dec 2016, 10:03 AM
Turan Erdem Simsek
Turan Erdem Simsek - avatar