美文网首页
c05ex05.py

c05ex05.py

作者: 特丽斯纳普 | 来源:发表于2018-03-30 20:30 被阅读0次
# c05ex05.py
#     Numerology of a single name


def main():
    print("This program computes the 'number value' of a name")
    print()

    name = input("Enter a single name: ")
    total = 0
    for letter in name:
        total = total + ord(letter.lower()) - ord('a') + 1

    print("The value is:", total)

main()

相关文章

网友评论

      本文标题:c05ex05.py

      本文链接:https://www.haomeiwen.com/subject/ltqwcftx.html