ord function problem from newbie

2008-03-17 Thread David . J . Anderson66
I'm trying to convert a name into a numerical value that is not consistent with ANSCII values. In my case, I convert all to lowercase, then try to sum the value of the letters entered by the user, can't get it to add them. Here is what I have. By the way, the values I need to use is: a=1, b=2,

Re: ord function problem from newbie

2008-03-17 Thread Steven Clark
print sum([ord(ch)-96 for ch in small]) On Mon, Mar 17, 2008 at 11:28 PM, [EMAIL PROTECTED] wrote: I'm trying to convert a name into a numerical value that is not consistent with ANSCII values. In my case, I convert all to lowercase, then try to sum the value of the letters entered by the

Re: ord function problem from newbie

2008-03-17 Thread Paul Rubin
[EMAIL PROTECTED] writes: for ch in small: v = ord(ch)-96 print v total = 0 for ch in small: # the += below updates the value of total by adding (ord(ch) - 96) total += (ord(ch) - 96) print ch:, ch, total so far:, total --

Re: ord function problem from newbie

2008-03-17 Thread 7stud
[EMAIL PROTECTED] wrote: I convert all to lowercase, import string small = string.lower(name) print Here is the calculated value: print small for ch in small: v = ord(ch)-96 print v I don't know if you are using an out of date