Assigning a numerical value to each alphabet in corresponding order and then summing any inputted word
Honestly, the initial words_to_marks function is full of "anti-patterns/bad smells".

When reviewing in steps:


instead of iterating over string.ascii_lowercase and generating/filling a dictionary of letter indices on each function call with:

for index, letters in enumerate(string.ascii_lowercase, 1):     # creates the dictionary
    values[letters] = index


create a predefined top-level dict lowercase_indices_map at once:

import string

lowercase_indices_map = {c:i for i, c in enumerate(string.ascii_lowercase, 1)}

converting each letter of the word with:

for letter in s:
   letter_lower = letter.lower


is completely redundant as the whole word can be lowercased at once s = s.lower()
and the "magic" like:

values_of_words.append(sum(final))  # sums all the values in the list
submit = str(values_of_words)       # converts into string so I can remove the brackets around the list
return submit[1:-1]


is just an unnecessary thing that you should avoid doing in future. The sum of letter indices is simply calculated with a single sum(...) call.




The whole idea fits in few lines of code:

import string

lowercase_indices_map = {c:i for i, c in enumerate(string.ascii_lowercase, 1)}

def sum_letters_indices(word):
    word = word.lower()
    return sum(lowercase_indices_map[char] for char in word)


Sample usage:

print(sum_letters_indices("hello"))    # 52
print(sum_letters_indices("friends"))  # 75