Need some help...
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Oct 29 05:27:23 EDT 2007
hyozan.ux3 at gmail.com a écrit :
> I want to create a program that I type in a word.
>
> for example...
>
> chaos
>
> each letter equals a number....
>
> A=1
> B=20
>
> and so on.
>
> So Chaos would be
>
> C=13 H=4 A=1 O=7 S=5
>
> I want to then have those numbers
> 13+4+1+7+5 added together to be 30.
>
> How can I do that?
If the values are arbitrary:
letters_values = {'A':1, 'B':20, 'C':13, 'H':4, 'O':7, 'S':5, #etc...}
print letters_values['A']
> Also, just curious, but, how could I then have the 3 and 0 added
> together to be 3?
help(sum)
help(map)
help(int)
print int('3')
help(list)
print list('30')
help(str)
print str(30)
More information about the Python-list
mailing list