Пример #1
0
def solve():
    with open("../res/task42_words.txt") as f:
        words = f.read()[1:-1].split('","')
        triangles = set(triangle_numbers(200))
        return sum(1 for word in words if word_value(word) in triangles)
Пример #2
0
def solve():
    with open("../res/task22_names.txt") as file:
        names = file.read()[1:-1].split('","')
    return sum((i + 1) * word_value(name)
               for i, name in enumerate(sorted(names)))
Пример #3
0
def solve():
    with open("../res/task22_names.txt") as file:
        names = file.read()[1:-1].split('","')
    return sum(
        (i + 1) * word_value(name) for i, name in enumerate(sorted(names)))