Difference between \ and \\ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between \ and \\

9\2=____ 9\\2=____

23rd Sep 2018, 1:51 PM
Jayank Aghara
Jayank Aghara - avatar
3 Answers
+ 4
Your slashes are wrong: print(9/2) print(9//2) Try my code for yourself if you want to see the difference.
23rd Sep 2018, 1:58 PM
Paul
Paul - avatar
+ 2
/ → used for normal division. returns float (9 / 2 == 4.5) // → used for floor division. returns int. (9//2 == 4)
23rd Sep 2018, 2:01 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 2
\ gives exact value of divide. 9\2=4.5 but \\ use for floor division. 9\\2 -------- 2| 9 |4 -------- 1 answer is 4 and here remainder is 1 which can find like this. 9%2=1
23rd Sep 2018, 2:15 PM
Maninder $ingh
Maninder $ingh - avatar