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

What does // do?

I saw it in a piece of code

14th Nov 2018, 4:04 AM
Daniel Sheldon
Daniel Sheldon - avatar
7 Answers
+ 3
It's the floor division in Python. And it should be 3//5 and not 3\\5
14th Nov 2018, 4:40 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
In many languages it's a comment but not in the one you tagged, Python. If can expect better help if you could provide the code.
14th Nov 2018, 4:32 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
3//5 = 0 5//3 = 1
14th Nov 2018, 4:42 AM
Шащи Ранжан
Шащи Ранжан - avatar
0
Sorry, say, X= 3\\5
14th Nov 2018, 4:33 AM
Daniel Sheldon
Daniel Sheldon - avatar
0
Its int division or something It behave kinda like division in c/c++ if divisor is int, where the result is floored to int
14th Nov 2018, 4:39 AM
Taste
Taste - avatar
0
Thank you!
14th Nov 2018, 4:40 AM
Daniel Sheldon
Daniel Sheldon - avatar
0
What about when it is in front of words, such as: print("Hello \\World!") Is that just an error, or does it count the number of letters or something?
26th Nov 2018, 3:12 PM
Daniel Sheldon
Daniel Sheldon - avatar