simeonshopov

Best plane ticket (late july exam)

Nov 5th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import sys
  2. flight = input()
  3. found, winner, winner_price = sys.maxsize, "", 0
  4.  
  5. while flight != "End":
  6.   price = float(input())
  7.   minutes_wait = int(input())
  8.   if minutes_wait < found:
  9.     found = minutes_wait
  10.     winner = flight
  11.     winner_price = price
  12.   flight = input()
  13. else:
  14.   hours = found // 60
  15.   minutes = found - hours * 60
  16.   print(f"Ticket found for flight {winner} costs {(winner_price * 1.96):.2f} leva with {hours}h {minutes}m stay")
Advertisement
Add Comment
Please, Sign In to add comment