Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number_of_pieces = int(input())
- pieces = {}
- for piece in range(number_of_pieces):
- information_about_pieces = input().split("|")
- current_piece = information_about_pieces[0]
- composer = information_about_pieces[1]
- key = information_about_pieces[2]
- pieces[current_piece] = [composer, key]
- receiving_commands = True
- while receiving_commands:
- command = input()
- if command == "Stop":
- receiving_commands = False
- break
- command = command.split("|")
- if command[0] == "Add":
- add_piece = command[1]
- add_composer = command[2]
- add_key = command[3]
- if add_piece not in pieces:
- pieces[add_piece] = [add_composer, add_key]
- print(f"{add_piece} by {add_composer} in {add_key} added to the collection!")
- else:
- print(f"{add_piece} is already in the collection!")
- elif command[0] == "Remove":
- remove_piece = command[1]
- if remove_piece in pieces:
- del(pieces[remove_piece])
- print(f"Successfully removed {remove_piece}!")
- else:
- print(f"Invalid operation! {remove_piece} does not exist in the collection.")
- elif command[0] == "ChangeKey":
- change_piece = command[1]
- new_key = command[2]
- if change_piece in pieces:
- pieces[change_piece][1] = new_key
- print(f"Changed the key of {change_piece} to {new_key}!")
- else:
- print(f"Invalid operation! {change_piece} does not exist in the collection.")
- for name in pieces:
- composer = pieces[name][0]
- key = pieces[name][1]
- print(f"{name} -> Composer: {composer}, Key: {key}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement