+ 3
Excuse me..5//2 quotient is actually 2.5 - a float..but here we take it only 2.Why??sorry new to python-maybe a silly question
2 ответов
+ 25
/ will give 2.5 or simply a float
// will give floor division i.e 2 or simply will give you integer.
+ 6
in python, 5 / 2 is normal division and will give you 2.5
but 5 // 2 is integer division, so it will take the answer (2.5) and cut off the decimal, so you only get the whole number integer (2)
and remember it doesnt round. so like if you use integer division and the answer should be 4.82, it will still give you 4. it wont round to 5