Need help on this please anyone | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Need help on this please anyone

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.

11th Aug 2022, 4:54 PM
OLAMIDE
OLAMIDE - avatar
9 Answers
+ 2
What help you need on this? Share your try please? Or your trouble?
11th Aug 2022, 5:01 PM
Jayakrishna 🇮🇳
+ 1
OLAMIDE print = 7425 # assignment, valid covering= 550 #assignment, valid average_speed = '1hour' # valid but no need print =(7425 / 550) # still assignment, not print statement.. to print use print( 7425/550 ) # correct proper way to write is : distance = 7425 speed = 550 print( distance/speed ) # or just write here, like print( 7425/550 )
11th Aug 2022, 6:06 PM
Jayakrishna 🇮🇳
0
print = 7425 covering = 550 average_speed = "1 hour" print = ('7425 \\ 550') Was unable to get the float as answer
11th Aug 2022, 5:07 PM
OLAMIDE
OLAMIDE - avatar
0
Anything you write in between quotes ' ' or " " , becomes a string. Remove quote ' ' \\ not operator, // is floor division operator. And // performs floor division so it returns an int value.. use / operator gives you praction part also... OLAMIDE print = ' ' its a variable now. not print command. you may using older version. use print( 7425/550 )
11th Aug 2022, 5:14 PM
Jayakrishna 🇮🇳
0
On it now boss
11th Aug 2022, 5:14 PM
OLAMIDE
OLAMIDE - avatar
0
print = 7425 covering= 550 average_speed = '1hour' print =(7425 / 550) Got the right but i was ask to learn from my bugs,
11th Aug 2022, 5:36 PM
OLAMIDE
OLAMIDE - avatar
0
OLAMIDE Mistakes you are performing ..... 1) don't use = sign after print . 2) use / sign when dividing it will give you float and double sign // when you don't need answer in float. 3)if you add (" ")in brackets that will be count in string not in integer .
13th Aug 2022, 2:22 PM
Sayyam Jain
Sayyam Jain - avatar
0
Thanks so much. Solved already.
13th Aug 2022, 2:37 PM
OLAMIDE
OLAMIDE - avatar
- 1
print = 7425 covering = 550 average_speed = '1hour' print = ('7425 \ 550') Still the same thing
11th Aug 2022, 5:17 PM
OLAMIDE
OLAMIDE - avatar