Exemplo n.º 1
0
def calculate_things_semester(file_name):
    semester = input('Enter the semester number: ')
    disc_list = file_modules.listing(file_name)
    total_hours = 0
    for discipline in filter(lambda x: x[1] == semester, disc_list):
        total_hours += int(discipline[2])
    return total_hours
Exemplo n.º 2
0
def calculate_oldest_book(file_name):
    books_list = file_modules.listing(file_name)
    oldest_book = None
    oldest_year = int(books_list[0][3])
    for book in filter(lambda x: int(x[3]) < oldest_year, books_list):
        oldest_book = book
    return oldest_book
Exemplo n.º 3
0
def calculate_most_populated(file_name, continent):
    country_list = file_modules.listing(file_name)
    most_populated = country_list[0]
    for country in filter(
            lambda x: x[1] == continent and x[2] > most_populated[2],
            country_list):
        most_populated = country
    return country
Exemplo n.º 4
0
def calculate_unique_lecturers(file_name):
    disc_list = file_modules.listing(file_name)
    lecturers_list = []
    for discipline in filter(lambda x: x[4] not in lecturers_list, disc_list):
        lecturers_list.append(discipline[4])
    return lecturers_list
Exemplo n.º 5
0
def youngest_creditor(file_name):
    clients_list = file_modules.listing(file_name)
Exemplo n.º 6
0
def calculate_credits(file_name):
    clients_list = file_modules.listing(file_name)
    return reduce(lambda l, r: l + int(r[4]), clients_list, 0)
Exemplo n.º 7
0
def calculate_continent_countries(file_name, continent):
    country_list = file_modules.listing(file_name)
    smr = 0
    for country in filter(lambda x: x[1] == continent, country_list):
        smr += 1
    return smr
Exemplo n.º 8
0
def calculate_unique_authors(file_name):
    books_list = file_modules.listing(file_name)
    unique_authors = []
    for book in filter(lambda x: x[0] not in unique_authors, books_list):
        unique_authors.append(book[0])
    return unique_authors