Advertisement
Guest User

Untitled

a guest
Jul 9th, 2020
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. curr_destination_name = input()
  2. curr_destination_min_price = float(input())
  3.  
  4. is_num = False
  5. is_min_price = False
  6. curr_saved_money = 0
  7. curr_money_to_add = 0
  8.  
  9. #Will assume that every Destination/Min Budget iteration is separate, with no carry over of previous saved money
  10.  
  11. while True:
  12.     command = input()
  13.     is_num = command.isnumeric()
  14.  
  15.     if is_num == False:
  16.         if command == "End":
  17.             break
  18.         else:
  19.             curr_destination_name = command
  20.     else:
  21.         if is_min_price == False:
  22.             curr_money_to_add = float(command)
  23.             curr_saved_money += curr_money_to_add
  24.             if curr_saved_money >= curr_destination_min_price:
  25.                 print(f"Going to {curr_destination_name}!")
  26.                 is_min_price = True
  27.                 curr_saved_money = 0
  28.         else:
  29.             curr_destination_min_price = float(command)
  30.             is_min_price = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement