I need help with this program please.
This is a program that will turn your first name into a group of numbers with a being equal to 1 and so on. This program does this but I need to have it total all the numbers in the name. I was told try an accumulator but so far I haven't had any luck.
Thank you
import string
import math
def main():
print ("This is a program that converts a users first name into it's numerical value." )
#get name
name = raw_input("Please enter your name: ")
uname = string.lower (name)
#Use ASCII minus 96 to get numeric values
print "Here is your name code:"
for ch in(uname):
x = ord(ch)-96,
string.sum(x)
print sum(x),
raw_input("Press <Enter> to exit")
main()
Sorry for placing my first post in the welcome center lol. I'm new here.
I need help with this program please.
This is a program that will turn your first name into a group of numbers with a being equal to 1 and so on. This program does this but I need to have it total all the numbers in the name. I was told try an accumulator but so far I haven't had any luck.
Thank you
import string
import math
def main():
print ("This is a program that converts a users first name into it's numerical value." )
#get name
name = raw_input("Please enter your name: ")
uname = string.lower (name)
#Use ASCII minus 96 to get numeric values
print "Here is your name code:"
for ch in(uname):
x = ord(ch)-96,
string.sum(x)
print sum(x),
raw_input("Press <Enter> to exit")
main()