Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bands = {}
- bands_time = {}
- while True:
- com = input()
- if com == 'start of concert':
- break
- com = com.split('; ')
- command = com[0]
- band = com[1]
- if command == 'Add':
- members = com[2].split(', ')
- if band not in bands:
- bands[band] = []
- for member in members:
- if member not in bands.values():
- bands[band] += [member]
- else:
- bands[band] += [member for member in members if member not in bands[band]]
- elif command == 'Play':
- time = int(com[2])
- if band not in bands_time:
- bands_time[band] = time
- else:
- bands_time[band] += time
- total_time = sum(bands_time.values())
- print(f'Total time: {total_time}')
- for key, value in sorted(bands_time.items(), key=lambda x: (-x[1], x[0])):
- print(f'{key} -> {value}')
- more = input()
- print(f'{more}')
- for v in bands[more]:
- print(f'=> {v}')
Advertisement
Add Comment
Please, Sign In to add comment