Variable problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Variable 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. I answered print(7245/550) But the answer somehow is incorrect

21st Dec 2022, 5:28 PM
Prem Suthar
Prem Suthar - avatar
33 Answers
+ 3
Maybe try print(float(7425/550)) Maybe it wants the answer as a float?
21st Dec 2022, 5:58 PM
Hassanah
Hassanah - avatar
+ 6
Hassanah is correct, it should be a float. Python automatically converts division into a float. Prem Suthar look closely at your numbers and look at what Hassanah wrote. They are different.
21st Dec 2022, 7:05 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Auricelio I too guess that's the answer but its showing that it isn't
22nd Dec 2022, 4:44 AM
Prem Suthar
Prem Suthar - avatar
+ 3
Thanks to all of you for showing your effort ! 💞
22nd Dec 2022, 4:49 AM
Prem Suthar
Prem Suthar - avatar
+ 3
Jay Do the python beginners course, good luck!
23rd Dec 2022, 1:03 AM
Arcaderock
+ 3
Djzani Qwhuame & Jay please start your own thread and don't try to take over someone else's.
23rd Dec 2022, 10:00 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Hello, Is it ok if you could put a link to your code? Also do you know what the output should be?
21st Dec 2022, 5:33 PM
Hassanah
Hassanah - avatar
+ 2
I cannot link as it is an part of lesson And i searched about the code answers and i get the same code which i wrote , but its wrong Hassanah
21st Dec 2022, 5:47 PM
Prem Suthar
Prem Suthar - avatar
+ 2
Wouldn't the answer be print(7245 // 550)? This way, time would be 13 hours.
21st Dec 2022, 10:56 PM
Auricelio
+ 2
Per Bratthammar The answer should be in float.
22nd Dec 2022, 4:38 AM
Prem Suthar
Prem Suthar - avatar
+ 2
Ausgrindtube I understood what Hassanah said , i have checked the numbers multiple times.
22nd Dec 2022, 4:40 AM
Prem Suthar
Prem Suthar - avatar
+ 2
Hassanah Yes ! That's the correct answer Thank you so much buddy
22nd Dec 2022, 4:49 AM
Prem Suthar
Prem Suthar - avatar
+ 2
You're welcome Prem Suthar!
22nd Dec 2022, 9:55 AM
Hassanah
Hassanah - avatar
+ 2
Jay Take the course buddy
22nd Dec 2022, 11:43 PM
matthias boettcher
+ 2
Jay, as u were asking so politely: Theres multiple courses: - Python for beginners - Core python Teaching you coding in chat wont work, at least not for me.
23rd Dec 2022, 11:56 AM
matthias boettcher
+ 1
Ausgrindtube Yeah , he is correct thanks for the effort
22nd Dec 2022, 4:50 AM
Prem Suthar
Prem Suthar - avatar
+ 1
BALAJI A Uhh , yeah it's correct , but it could be simply done in one line.
22nd Dec 2022, 2:20 PM
Prem Suthar
Prem Suthar - avatar
+ 1
7245 is in your answer, but 7425 is in the task
22nd Dec 2022, 3:45 PM
Danis Idiatullin
Danis Idiatullin - avatar
+ 1
You mixed up the numbers and changed the value, it's 7425 but in the code you used 7245. Hope you see it
22nd Dec 2022, 8:25 PM
Keystroke
Keystroke - avatar
+ 1
Hi Im new Can someone teach me python on this chat
22nd Dec 2022, 10:43 PM
Jay