Runtime Error - KOL15A [[CLOSED]]

Problem : KOL15A

Why am I getting a runtime error on this code?

# cook your dish here
for tc in range(int(input())):
    alpha = 'abcdefghijklmopqrstuvwxyz'
    str1 = input().strip()
    sum_str = 0
    for i in str1:
        if i not in alpha:
            sum_str = sum_str+int(i)
    if len(str1) == 0:

test cases do just fine. Has happened to me before and had to rewrite the code with a different logic. But this seems like a legit solution.

Your set of alphabets is missing n.

To prevent such mistakes, use from string import ascii_lowercase
ascii_lowercase is equal to 'abcdefghijklmnopqrstuvwxyz'

Example solution using the above tip:

1 Like

yes fixed! thank you