ord function problem from newbie

Paul Rubin http
Mon Mar 17 23:58:24 EDT 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