Need help understanding math of distance converstion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Need help understanding math of distance converstion

Hello, I tried to solve the question highlighted in the triple quotes below. I assumed that dividing by 1.6 to fiind what 1 kilometer in miles is then multiplying by 1000 for 1000 km should give the correct unit the answer suggests (624.0) but it does not. When I checked online 1000km = roughly 621.37 miles, so why is the accepted answer 624? Also when I do floor divison like 1000//1.6 i get 624 but when i do regular division of 1000/1.6 I get 625, why is this so if there is no remainder? Thanks https://code.sololearn.com/cTLoF70bpp1E/?ref=app

1st Apr 2022, 12:23 PM
Bubblegum Princess
Bubblegum Princess - avatar
4 Answers
1st Apr 2022, 12:32 PM
Simba
Simba - avatar
+ 2
you can use //int but not recommended using //float
3rd Apr 2022, 11:39 AM
Demiz 🇬🇭🇬🇭🇱🇷🇱🇷
Demiz 🇬🇭🇬🇭🇱🇷🇱🇷 - avatar
+ 1
Using // and a floating number as a dividend is the reason why you get an error.
1st Apr 2022, 12:33 PM
Orisa
Orisa - avatar
+ 1
print(1000//1.61) #take 2decimals =>621
1st Apr 2022, 12:48 PM
Jayakrishna 🇮🇳