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

What does the // do in python and c++?

4th Oct 2018, 11:49 PM
Saquelain Mokhtar
2 Answers
0
In python, the double forward slash is used when you want the result of a mathematical calculation as an integer and not as float e.g. 7/6 = 1.1666666666667 then 7//6 = 1 (it truncates the result) BTW, that's python 3. Not sure about its function in C++.
5th Oct 2018, 4:00 AM
Peter
Peter - avatar
0
In C++ it is used for comments.
5th Oct 2018, 10:35 PM
HonFu
HonFu - avatar