#Skip to menu

Names scores

First read the problem description.
from urllib.request import urlopen


def read_names():
    names_data = ""
    try:
        with open("22.txt") as f:
            names_data = f.read()
    except FileNotFoundError:
        with urlopen("https://xojoc.pw/project-euler/22.txt") as response:
            names_data = response.read().decode()

    return (name.strip('"\n') for name in names_data.split(sep=','))


def name_score(name):
    return sum(ord(l) - ord('A') + 1 for l in name)


total = 0
names = sorted(read_names())
for nth, name in enumerate(names, start=1):
    total += nth * name_score(name)

Source code of the solution(s):