ord function problem from newbie

Paul Rubin http
Tue Mar 18 04:58:24 CET 2008


David.J.Anderson66 at gmail.com 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



More information about the Python-list mailing list