What's the answer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the answer?

The title is You need to calculate the flight time of an upcoming trip. You are flying from LA to Sydney, covering a distance of 7425 miles, the plane flies at an average speed of 550 miles an hour. Calculate and output the total flight time in hours. Hint The result should be a float. My answer is Print (7425//550) Anything wrong with my answer? I have no idea.

5th Aug 2021, 5:57 AM
Ferris
Ferris - avatar
2 Answers
+ 9
Ferris , ▪︎the task description says that the result has to be a float not an int, use / instead of //. ▪︎also print() has to be spelled in lowercase letters. happy coding!
5th Aug 2021, 6:08 AM
Lothar
Lothar - avatar
+ 1
Lothar Thank you sooo much. I nailed it finally. 😀😀😀😀😀😀 I saw one comment before: For those who are surprised that the correct answer is not "6". It's because in Python Operators; "/"(single bar) returns a float type number whereas; "//"(double bars) returns integer type number And as there is "/" in the equation, it returned the float type to value 6, making it become a float type number with a decimal place. Right answer: 6.0 (float type)
5th Aug 2021, 6:14 AM
Ferris
Ferris - avatar