Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. def my_mp3_playlist(file_path):
  2. file_input = open(file_path, "r")
  3. longest_song = ""
  4. artist = ""
  5. new_list = []
  6. counter = 0
  7. new_list = list()
  8. for line in file_input:
  9. counter += 1
  10. line = line.split(";")
  11. if line[2] > longest_song:
  12. longest_song = line[2]
  13. if line[1] not in new_list:
  14. new_list.append(line[1])
  15. if line[1] in new_list:
  16. artist = line[1]
  17. file_input.close()
  18. file_input = open(file_path, "r")
  19. for line in file_input:
  20. line = line.split(";")
  21. if longest_song in line:
  22. longest_song = line[0]
  23. file_input.close()
  24. return (longest_song, counter, artist)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement