示例#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
示例#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
示例#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
示例#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
示例#5
0
def youngest_creditor(file_name):
    clients_list = file_modules.listing(file_name)
示例#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)
示例#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
示例#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