[Tutor] Newb Learning Question

Alan Gauld alan.gauld at btinternet.com
Thu Apr 3 01:31:47 CEST 2008


"Jeffrey Dates" <kungfukoi at gmail.com> wrote

> Let me get back to you with my result after I study this a bit.
> thanks!!

One wee tip you might find useful.

To test if a lertter comes after 'm you could

a) create a string with all letters after m

>>> after_m = 'nopqrstuvwxyz'

then test whether your characters were in after_m:

>>> if c in after_m: print c

OR

b) see if the ascii value of your character is bigger 
than the ascii value of 'm' And you can check the 
ascii value using ord()

There are pros and cons to both approaches. 
Pick the one you like best, we can debate 
the ideal solution for any given case later...

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list