+ 3
What is the right answer of flight time quize
distance=7425 speed=550 time=(distance//speed) print(time 'hour')
13 ответов
+ 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
+ 3
now correct the integer division to the normal division
+ 3
So the answer is 1hour👍
+ 2
print(time)
+ 2
now correct the integer division to the normal division
Thanks
Yaroslav Vernigora
+ 2
I ᴀᴍ "Tɪᴍᴇ"
Thanks
+ 2
Kshitiz
Ya answer is 1 hour
+ 1
Thanks.
0
distance=742
speed=550
time=(distance//speed)
print(time )
Is not working
0
// means quotient
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
0
This is correct Answer
👇👇👇👇👇
print(7425 / 550)