Advertisement
Koopcio

display

Oct 30th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. def print_table(albums):
  2. for album in albums:
  3. print(album)
  4.  
  5. def display_menu():
  6. print("menu:")
  7. print("1 -> Find all albums")
  8. print("2 -> find all albums by genre")
  9. print("3 -> find all albums from given time range")
  10. print("4 -> find shortest/longest album")
  11. print("5 -> find all albums created by given artist")
  12. print("6 -> find all albums by name")
  13. print("7 -> get full report in form of set of given statistics")
  14. print("0 -> exit")
  15.  
  16.  
  17. def print_albums_by_given_time_range(one_album):
  18. print()
  19. minimal_time_in_minutes = (input('Minimum time of album: (in minutes) '))
  20. print()
  21. maximum_time_in_minutes = (input('Maximum time of album: (in minutes) '))
  22. minimal_time_in_seconds = int(minimal_time_in_minutes) * 60
  23. maximum_time_in_seconds = int(maximum_time_in_minutes) * 60
  24. for elem in one_album:
  25. length_of_album = elem[-1]
  26. (m, s) = length_of_album.split(':')
  27. length_of_album_in_seconds = int(m) * 60 + int(s)
  28. if length_of_album_in_seconds in range(minimal_time_in_seconds, maximum_time_in_seconds):
  29. print()
  30. print(elem)
  31.  
  32.  
  33. def print_short_long_album(one_album):
  34. list_of_album_times = []
  35. print()
  36. short_album = (input("Shortest album press 's' longest album press'l'"))
  37. print()
  38. for elem in one_album:
  39. length_of_album = elem[-1]
  40. (m, s) = length_of_album.split(':')
  41. length_of_album_in_seconds = int(m) * 60 + int(s)
  42. list_of_album_times.append(length_of_album_in_seconds)
  43. print(list_of_album_times)
  44. print(min(list_of_album_times))
  45. print(max(list_of_album_times))
  46.  
  47.  
  48. def print_album_by_name_of_album(one_album):
  49. one_album = one_album
  50. album_name = input("Enter a name you want to sort albums:")
  51. for elem in one_album:
  52. if album_name.lower() == elem[1].lower():
  53. print(elem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement