Advertisement
SetKaung

Quiz2_Set1

Feb 18th, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. flight_height = int(input('Enter the height of the flight: '))
  2. km_to_travle = int(input('Enter the KM to travle: '))
  3. wind_cond = input('Wind Condition (H/C/T) : ')
  4.  
  5. wind_cond = wind_cond.lower()
  6.  
  7. fuel_percent = 0
  8.  
  9. if wind_cond == 'h':
  10.     fuel_percent = 0.05
  11. elif wind_cond == 'c':
  12.     fuel_percent = 0.02
  13. else:
  14.     fuel_percent = -0.04
  15.  
  16.  
  17. if flight_height < 10000 or flight_height > 35000:
  18.     print('NO Fly Zone')
  19. else:
  20.     fuel_comp = 0
  21.    
  22.     #t = s/v
  23.     total_min = km_to_travle / (1000/100) # distance / velocity
  24.  
  25.     total_min += total_min * fuel_percent # time + (time * fuel_percent)
  26.  
  27.     # n = q.60+r
  28.     time_hour = total_min//60
  29.     # r = n - (q*60)
  30.     time_min = total_min - (time_hour*60)
  31.  
  32.     if flight_height > 25000:
  33.         fuel_comp = km_to_travle * (1000/1000)
  34.         fuel_comp += fuel_comp * fuel_percent
  35.     elif flight_height > 20000:
  36.         fuel_comp = km_to_travle * (1500/1000)
  37.         fuel_comp += fuel_comp * fuel_percent
  38.     else:
  39.         fuel_comp = km_to_travle * (2000/1000)
  40.         fuel_comp += fuel_comp * fuel_percent
  41.    
  42.     print(f"AirPlane should carry {fuel_comp} liters of fuel.")
  43.     print(f"Flight will be {int(time_hour)} hours and {int(time_min)} minutes long.")
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement