Hello, how can I solve this Python problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Hello, how can I solve this Python problem?

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. Print ( 7425//550+7425%550) =》 why it's not true ? 😕

29th Jun 2022, 6:01 AM
Zahra
Zahra - avatar
3 Answers
+ 2
But it says the answer should be float, but your output is int 7425 / 550
29th Jun 2022, 6:04 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 2
print(float(2546//66)) if it were java you would prior outright have to declare datatype before referencing. 'String variable'
29th Jun 2022, 7:42 AM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
+ 1
¡Hola! Aquí está la manera de calcular el tiempo de vuelo total en español: 1. Divide la distancia (7425 millas) por la velocidad promedio (550 millas por hora) para obtener el tiempo total en horas: `7425 / 550`. 2. El cociente te dará el número entero de horas. 3. El residuo `%` te dará la distancia restante que se cubre en una fracción de hora (minutos). 4. Suma estos dos valores para obtener el tiempo de vuelo total en horas. Aquí tienes el código corregido: ```python tiempo_total = 7425 / 550 + (7425 % 550) / 550 print(tiempo_total) ``` Esto te dará la salida correcta, incluyendo la fracción de hora.
6th Jul 2023, 7:03 PM
Raúl Luevano P
Raúl Luevano P - avatar