Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- discovered_plants = {}
- number_of_information = int(input())
- for receiving_info in range(number_of_information):
- plant, rarity = input().split("<->")
- discovered_plants[plant] = [rarity]
- commands = input()
- while commands != "Exhibition":
- current_command = commands.split(": ")[0]
- name_plant = commands.split(": ")[1].split(" - ")[0]
- if name_plant not in discovered_plants:
- print("error")
- elif current_command == "Rate":
- rate_plant = int(commands.split(": ")[1].split(" - ")[1])
- discovered_plants[name_plant].append(rate_plant)
- elif current_command == "Update":
- rarity_plant = commands.split(": ")[1].split(" - ")[1]
- discovered_plants[name_plant][0] = rarity_plant
- elif current_command == "Reset":
- discovered_plants[name_plant] = discovered_plants[name_plant][0]
- commands = input()
- print("Plants for the exhibition:")
- for plants_for_exhibition in discovered_plants:
- name_of_plant = plants_for_exhibition
- rarity_of_plant = discovered_plants[plants_for_exhibition][0]
- calculating_rating = 0
- if len(discovered_plants[plants_for_exhibition]) > 1:
- calculating_rating = sum(discovered_plants[plants_for_exhibition][1:]) / \
- len(discovered_plants[plants_for_exhibition][1:])
- print(f"- {name_of_plant}; Rarity: {rarity_of_plant}; Rating: {calculating_rating:.2f}")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement