Excuse me..if 5//2 why wont the result be 2.5 but 2.Srry..new to python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Excuse me..if 5//2 why wont the result be 2.5 but 2.Srry..new to python.

22nd Apr 2017, 4:22 PM
Naseef
Naseef - avatar
5 Answers
+ 30
// is used for floor division, it'll give you the nearest whole number (floor) :) if you want 2.5, then use 5/2
22nd Apr 2017, 4:25 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 17
// this means floor division suppose the number is 5.6 it will be 5 after floor division it simply is int value no fraction value will remain so if it is 5//2 then the real answer is 2.5 but it will be 2 because no fraction value 😃 hope u understand
23rd Apr 2017, 1:57 PM
Samira
Samira - avatar
+ 14
@shakib first of all complete the courses in here and do the challenges then if u have any problem u can ask your question 😃
23rd Apr 2017, 11:57 PM
Samira
Samira - avatar
+ 1
how can i imrove my skill@sam
23rd Apr 2017, 5:54 PM
Shakib Ur Rahman
Shakib Ur Rahman - avatar
+ 1
2|5|2 4 ----- 1 ............ 2|5|2.5 4 ----- 10 10 that's why 2
31st May 2017, 11:17 PM
Susovan Das
Susovan Das - avatar