DNPotapov / Codewars-katas-

0 stars 0 forks source link

ASCII Total (8 kyu) #11

Open DNPotapov opened 2 years ago

DNPotapov commented 2 years ago
def uni_total(s):
    res = 0
    for item in s:
        res += ord(item)
    return res
DNPotapov commented 2 years ago

You'll be given a string, and have to return the sum of all characters as an int. The function should be able to handle all ASCII characters.

examples:

uniTotal("a") == 97 uniTotal("aaa") == 291

DNPotapov commented 1 year ago

https://www.codewars.com/kata/572b6b2772a38bc1e700007a