Advertisement
AlexG2230954

ДЗ. Задание 10

May 22nd, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. def get_track():
  2.     track_name, author, year = map(str.strip, input().split("|"))
  3.     return (track_name, author, int(year))
  4.  
  5.  
  6. tracks = dict()
  7. n = int(input())
  8.  
  9. for _ in range(n):
  10.     track, author, year = get_track()
  11.  
  12.     if(track not in tracks) or (tracks[track][1] > year):
  13.         tracks[track] = (author, year)
  14.  
  15. out = ["{} - {}".format(author, track) for track, (author, year) in tracks.items()]
  16. out.sort()
  17.  
  18. print(*out, sep="\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement