What is the right answer of flight time quize | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the right answer of flight time quize

distance=7425 speed=550 time=(distance//speed) print(time 'hour')

15th Jul 2021, 10:35 AM
Jupi
Jupi - avatar
12 Answers
+ 4
Jupitora Roy distance is 7425 And also use normal division (/) There are two type of division 1 - normal division (/) which gives result with decimal 2 - floor division (//) which gives result without decimal So for example: print (5 / 2) = 2.5 print (5 // 2) = 2
15th Jul 2021, 10:50 AM
A͢J
A͢J - avatar
+ 3
now correct the integer division to the normal division
15th Jul 2021, 10:43 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 3
So the answer is 1hour👍
15th Jul 2021, 10:57 AM
Kshitiz
Kshitiz - avatar
+ 2
print(time)
15th Jul 2021, 10:37 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
now correct the integer division to the normal division Thanks Yaroslav Vernigora
15th Jul 2021, 10:58 AM
Jupi
Jupi - avatar
15th Jul 2021, 10:59 AM
Jupi
Jupi - avatar
+ 2
Kshitiz Ya answer is 1 hour
15th Jul 2021, 11:02 AM
Jupi
Jupi - avatar
+ 1
Thanks.
15th Jul 2021, 11:04 AM
Kshitiz
Kshitiz - avatar
0
distance=742 speed=550 time=(distance//speed) print(time ) Is not working
15th Jul 2021, 10:42 AM
Jupi
Jupi - avatar
0
// means quotient
15th Jul 2021, 10:56 AM
Kshitiz
Kshitiz - avatar
0
#We declare and assign our variables to int type values distance = 7425 speed = 550 #**************************** Notice**********************************# """ There are 3 types of division operations: - Normal division (/): Gives the exact quotient(in decimal form) e.g: 7/2 = 3.5 Floor division (//): Similar to division but returns the largest possible integer. e.g: 7//2 = 3 Modulus(%): returns the remainder of floor division. e.g: 7%2 = 1 """ #define our operation which returns either the approximate number of hours or #the exact number depending on question time = (distance // speed) 'Or: time = (distance / speed) for exact value Or for those who like complicating things ;-): checker = distance % speed #If you want approx number of hours rounded up if Checker == 0: time = (distance / speed) print(str(time) + " hour(s)") #If you want approx number of hours rounded up elif Checker > 0: time = (distance // speed) + 1 # No '+1' print(str(time) + " hour(s)") ' I am not sure this method of concatination in the print function; print(time 'hour') is correct(Maybe the source of error) You could use : + operator. join() method. % operator. format() function. f-string (Literal String Interpolation) You can find out more abut this on this page: https://www.journaldev.com/23575/JUMP_LINK__&&__python__&&__JUMP_LINK-string-concatenation
16th Jul 2021, 2:35 PM
Mendjemo Ngangom Gerard Ledoux
0
This is correct Answer 👇👇👇👇👇 print(7425 / 550)
17th Jul 2021, 9:38 AM
Uddipta Kashyap