Advertisement
Kaloyankerr

Best plane tickets

Oct 30th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. last_ticket = ''
  2. last_minutes = 10000
  3. last_price = 0
  4.  
  5. while True:
  6. ticket_number = input()
  7. if ticket_number == 'End':
  8. break
  9. price = float(input())
  10. minutes_in = int(input())
  11.  
  12. if minutes_in < last_minutes:
  13. last_ticket = ticket_number
  14. last_minutes = minutes_in
  15. last_price = price
  16.  
  17.  
  18. total_price = last_price * 1.96
  19. hours = last_minutes // 60
  20. minutes = last_minutes % 60
  21.  
  22. print(f"Ticket found for flight {last_ticket} costs {total_price:.2f} leva with {hours}h {minutes}m stay")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement