[Tutor] Please help me get started on how to program useing python 2.4!!!

Brian van den Broek bvande at po-box.mcgill.ca
Sat Mar 12 00:23:09 CET 2005


Danny Yoo said unto the world upon 2005-03-11 16:07:
> 
> On Fri, 11 Mar 2005 Jeff420harris00 at wmconnect.com wrote:

<SNIP>

> When we ask: "Is the number 'one' greater than the number 'two'?", Python
> is telling us "No!" by giving us back the value 'False'.  Whenever we ask
> Python a question that's a yes/no sort of thing, Python will respond with
> a value like 'True' or 'False'.
> 
> 
> We can also compare strings to see if a word is "bigger" than another
> word, based on where it might be located in a dictionary.  For example:
> 
> ###
> 
>>>>"application" < "applied"
> 
> True
> 
>>>>"applied" < "application"
> 
> False
> ###

A slight refinement of what Danny said: for strings, comparisons 
determine which string is "bigger" based on a concept of `dictionary 
order' where  x is `bigger' than y if it comes later in a dictionary 
which puts uppercase letters before lower case ones.

Hence:

 >>> 'z' < 'a'
False
 >>> 'Z' < 'a'
True
 >>>

Best,

Brian vdB



More information about the Tutor mailing list