Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def print_table(albums):
- for album in albums:
- print(album)
- def display_menu():
- print("menu:")
- print("1 -> Find all albums")
- print("2 -> find all albums by genre")
- print("3 -> find all albums from given time range")
- print("4 -> find shortest/longest album")
- print("5 -> find all albums created by given artist")
- print("6 -> find all albums by name")
- print("7 -> get full report in form of set of given statistics")
- print("0 -> exit")
- def print_albums_by_given_time_range(one_album):
- print()
- minimal_time_in_minutes = (input('Minimum time of album: (in minutes) '))
- print()
- maximum_time_in_minutes = (input('Maximum time of album: (in minutes) '))
- minimal_time_in_seconds = int(minimal_time_in_minutes) * 60
- maximum_time_in_seconds = int(maximum_time_in_minutes) * 60
- for elem in one_album:
- length_of_album = elem[-1]
- (m, s) = length_of_album.split(':')
- length_of_album_in_seconds = int(m) * 60 + int(s)
- if length_of_album_in_seconds in range(minimal_time_in_seconds, maximum_time_in_seconds):
- print()
- print(elem)
- def print_short_long_album(one_album):
- list_of_album_times = []
- print()
- short_album = (input("Shortest album press 's' longest album press'l'"))
- print()
- for elem in one_album:
- length_of_album = elem[-1]
- (m, s) = length_of_album.split(':')
- length_of_album_in_seconds = int(m) * 60 + int(s)
- list_of_album_times.append(length_of_album_in_seconds)
- print(list_of_album_times)
- print(min(list_of_album_times))
- print(max(list_of_album_times))
- def print_album_by_name_of_album(one_album):
- one_album = one_album
- album_name = input("Enter a name you want to sort albums:")
- for elem in one_album:
- if album_name.lower() == elem[1].lower():
- print(elem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement