[Tutor] String to integer?

Adam adam at monkeez.org
Wed Sep 1 19:49:48 CEST 2004


Blake Winton wrote:
> adam wrote:
> 
>> What's the easiest way of creating an integer which is based on a 
>> value of
>> a letter? I really don't mind if it was based on the ascii code, or
>> another equivalent.
> 
> 
>  >>> ord('a')
> 97
>  >>> chr(97)
> 'a'
>  >>> ord('ab')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: ord() expected a character, but string of length 2 found
> 
> (Putting on my user-hat for a second, you _really_ want 26 buttons on a 
> single form?!?  That's probably going to be confusing to look at.  Is 
> there another way you could get the user's input?)
> 
> Later,
> Blake.

Blake,

As this is an application designed to teach kids the alphabet, then yes, 
putting 26 buttons on the screen is pretty desirable.

Adam

-- 
site: http://www.monkeez.org
wiki: http://wiki.monkeez.org


More information about the Tutor mailing list