+ 2

How many hour will it take the plane to get to sydney?

I'm supposed to calculate a flight time from LA to sydney. Total distance is 7425 miles and the planes cover 550 miles per hour.

24th Sep 2021, 1:46 AM
bernard
bernard - avatar
10 ответов
+ 3
bernard like, only 13 and not 13.5? It's because integer division is taking place and it only shows the integer part. Use floating point division. Instead of doing this: x=7425/550 Do this: x=7425.0/550 As we used a double value in the second division, the interpreter will choose floating point division here and result in the correct value 13.5
24th Sep 2021, 2:04 AM
Rishi
Rishi - avatar
+ 2
Use math to solve the problem. If the plane covers 550 miles per hour, how many hours will it take to cover 7425 miles? We can use proportionality here 550:1=7425:x x is the number of hours we have to find. This can be written as: 550/1=7425/x Simplify it and take x on left side, we get, x/1=7425/550 Which is, x=13.5 hours So it'll take exactly 13.5 house for our ideal plane which travels at constant velocity, to reach 7425 miles. Applying this in your code is left as an exercise to you =) PS: Don't sleep during your maths class 😗
24th Sep 2021, 1:54 AM
Rishi
Rishi - avatar
+ 2
Rishi I really know the answer is 13.5 hours but after using the division in python only the quotient is shown
24th Sep 2021, 1:57 AM
bernard
bernard - avatar
+ 1
Ok
24th Sep 2021, 2:05 AM
bernard
bernard - avatar
+ 1
Jay Matthews No wonder we have so much COVID, everybody keeps visiting. 🤣😂🤣
24th Sep 2021, 5:10 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
bernard dont forget to take the vaccine first 🙂
24th Sep 2021, 10:05 AM
D_Stark
D_Stark - avatar
0
I couldn't believe the answer was so simple, but it is just print(7425/550)
24th Sep 2021, 2:56 AM
Elliot
Elliot - avatar
0
Elliot Owen Nah, it's print(7425.0/550)
24th Sep 2021, 4:10 AM
Rishi
Rishi - avatar
0
D_Stark 2 doses minimum, a mask & 2 weeks of social isolation. Welcome to Australia
24th Sep 2021, 10:08 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Using math formulas Td=7425 Dph=550 If 550 miles is taken an hour Then divide 7425 by 559 to get how many hours it will take 7425÷550 =13.5
24th Sep 2021, 8:56 PM
IE diamond