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

How "//" works

24th Aug 2019, 4:34 AM
Anjli Pathak
Anjli Pathak - avatar
3 Answers
+ 3
// is floor division in Python. To put it simply,it will return the largest integer smaller or equal to the result of a regular division of a number. Note that 5.5//5 gives 1.0 (1.1 to 1.0, 1.0<2.0). It is still a float number. -5.5//5 gives -2.0(-2.0<-1.0) If you want a pure integer,import math and use math.floor(x/y) instead. In C#, // indicates the start of a comment. / can already serve the above function.
24th Aug 2019, 4:47 AM
Ketchup🍅
Ketchup🍅 - avatar
+ 3
The // represent single line comments in several languages including C, C++, C#, JS, Java, Swift, Kotlin etc.
24th Aug 2019, 5:19 AM
Sonic
Sonic - avatar
+ 1
Thank u
24th Aug 2019, 4:47 AM
Anjli Pathak
Anjli Pathak - avatar