Advertisement
Yashov

Untitled

Feb 19th, 2023
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. travel_route = input().split("||")
  2. starting_fuel = int(input())
  3. starting_ammunition = int(input())
  4.  
  5.  
  6. for route in travel_route:
  7.     command_args = route.split()
  8.     command = command_args[0]
  9.     amount = command_args[1]
  10.  
  11.     amount = int(amount)
  12.  
  13.     if command == "Travel":
  14.         distance = amount
  15.         starting_fuel -= distance
  16.         if starting_fuel > amount:
  17.             print(f"The spaceship travelled {distance} light-years.")
  18.         else:
  19.             print("Mission failed.")
  20.             break
  21.     elif command == "Enemy":
  22.         enemy_armor = amount
  23.         if starting_ammunition >= enemy_armor:
  24.             starting_ammunition -= enemy_armor
  25.             print(f"An enemy with {enemy_armor} armour is defeated.")
  26.         else:
  27.             run_fuel = (starting_ammunition - enemy_armor) * 2
  28.             starting_fuel -= abs(run_fuel)
  29.             print(f"n enemy with {enemy_armor} armour is outmaneuvered.")
  30.     elif command == "Repair":
  31.         resources = amount
  32.         starting_fuel += resources
  33.         starting_ammunition += amount * 2
  34.         print(f"Ammunitions added: {(resources * 2)}.")
  35.         print(f"Fuel added: {resources}.")
  36.  
  37.     if command == "Titan":
  38.         print("You have reached Titan, all passengers are safe.")
  39.         exit()
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement