Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- targets = input().split("||")
- sailing = {}
- while True:
- town = targets[0]
- if town == "Sail":
- break
- population = int(targets[1])
- gold = int(targets[2])
- if town not in sailing:
- sailing[town] = [population, gold]
- else:
- sailing[town][0] += population
- sailing[town][1] += gold
- targets = input().split("||")
- command_data = input().split("=>")
- while True:
- command = command_data[0]
- if command == "End":
- break
- if command == "Plunder":
- town = command_data[1]
- people = int(command_data[2])
- treasure = int(command_data[3])
- sailing[town][0] -= people
- sailing[town][1] -= treasure
- print(f"{town} plundered! {treasure} gold stolen, {people} citizens killed.")
- if sailing[town][0] <= 0 or sailing[town][1] <= 0:
- print(f"{town} has been wiped off the map!")
- del sailing[town]
- elif command == "Prosper":
- town = command_data[1]
- given_gold = int(command_data[2])
- if given_gold < 0:
- print("Gold added cannot be a negative number!")
- else:
- sailing[town][1] += given_gold
- print(f"{given_gold} gold added to the city treasury. {town} now has {sailing[town][1]} gold.")
- command_data = input().split("=>")
- city_left = len(sailing)
- print(f"Ahoy, Captain! There are {city_left} wealthy settlements to go to:")
- for town in sailing:
- print(f"{town} -> Population: {sailing[town][0]} citizens, Gold: {sailing[town][1]} kg")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement