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

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

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()

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jlm699

First of all you need to surround your code with the code tags, to achieve something like this:

``import math``

I think you first try to tabulate your code and the read some documentation about global variables in python. This done, an accumulator will come out pretty straightforward.

best regards,
bc.

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

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()

Don't double post... but regardless, check your other post in this same forum.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.