If Python is a strongly typed language, why does it convert integers to floats during division? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If Python is a strongly typed language, why does it convert integers to floats during division?

24th May 2020, 6:49 PM
Ali Rezaei
Ali Rezaei - avatar
5 Answers
+ 3
Guido decided so.๐Ÿ˜‰ In python 2 the conversion wasn't done
24th May 2020, 6:59 PM
Oma Falk
Oma Falk - avatar
+ 1
Use floor division //
25th May 2020, 2:46 PM
Hisham YUM ๐Ÿ‡ฒ๐Ÿ‡ฆ
Hisham YUM ๐Ÿ‡ฒ๐Ÿ‡ฆ - avatar
0
Doesn't it?
24th May 2020, 6:53 PM
Oma Falk
Oma Falk - avatar
0
Yes it does, but why?
24th May 2020, 6:54 PM
Ali Rezaei
Ali Rezaei - avatar
0
Ali Rezaei you can use integer division operator in case if you don't won't float conversion. print(2/3) #float division print(2//3) #interger divsion
24th May 2020, 10:58 PM
$ยข๐Žโ‚น๐”ญ!๐จ๐“
$ยข๐Žโ‚น๐”ญ!๐จ๐“ - avatar