Beispiel #1
0
from task0 import Song
from task0 import import_songs
__author__ = 'Independence'


# creating lists:
songs = import_songs("songs1.txt")
artists = list()
artist_count = list()
albums = list()
album_count = list()
album_duration = list()
duration = list()
words = list()
word_count = list()
artist_album_count = list()

# main cycle(counting it all):
for song in songs:
    # counting artists:
    if song.artist not in artists:
        artists.append(song.artist)
        artist_count.append(1)
        artist_album_count.append(0)
    else:
        artist_count[artists.index(song.artist)] += 1
    # counting albums:
    if (song.album, song.artist) not in albums:
        albums.append((song.album, song.artist))
        album_count.append(1)
        album_duration.append(int(song.duration))
Beispiel #2
0
__author__ = "Alex"
from task0 import Song
from task0 import import_songs


def max_number(artist):
    dict = {}
    for i in artist:
        if artist not in dict:
            dict[i] = 1
        else:
            dict[i] += 1
    return dict


my_list = import_songs("1.txt")
artist = []
for i in my_list:
    artist.append(i.artist)
a = max_number(artist)
most_songs = max(a, key=a.get)
print(most_songs)