Sichanov

sale

May 27th, 2021
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. sea_trip_count = int(input())
  2. mountain_trip_count = int(input())
  3. command = input()
  4. price_of_sea_trip = 680
  5. price_of_mountain_trip = 499
  6. profit = 0
  7. is_sold = False
  8. while command != 'Stop':
  9.     destination = command
  10.     if destination == 'sea' and sea_trip_count > 0:
  11.         profit += price_of_sea_trip
  12.         sea_trip_count -= 1
  13.     elif destination == 'mountain' and mountain_trip_count > 0:
  14.         profit += price_of_mountain_trip
  15.         mountain_trip_count -= 1
  16.     if sea_trip_count == 0 and mountain_trip_count == 0:
  17.         is_sold = True
  18.         break
  19.     command = input()
  20. if is_sold:
  21.     print("Good job! Everything is sold.")
  22.     print(f"Profit: {profit} leva.")
  23. else:
  24.     print(f"Profit: {profit} leva.")
Advertisement
Add Comment
Please, Sign In to add comment