[Chicago] newbie says HI; needs help

Robert C. Ramsdell III rcriii at ramsdells.net
Sat Jan 21 04:53:15 CET 2006


On Thu, 2006-01-19 at 20:08 -0600, J.Almendariz wrote:
... snip...
>  
> Problem:  originally I wrote:
>  
> if texture == "flaky" or "caked":
>     stock = 1
> else:
>     stock = 2  
>  
> This never worked.  Cigars with "varied, fluffy, granular, " textures
> always ended up as stock 1.  So did the "flaky and caked".  
> -----------------------------------------------------------------------------
>  
> When I changed the line to:
>  
> if texture != "flaky" or "caked":
>     stock = 2
> else:
>     stock = 1
> the program works great.   I have no idea why.  Can anyone help me.
>  

I have no idea either.  The if always evaluates to true, since it is
evaluating the string 'caked' (i.e. not comparing it to texture), which
is true.  So in both cases stock ends up = 1 always.  I think that what
you want is:

if texture in ['flaky', 'caked']:
    stock = 1
else:
    stock = 2

>  
> Thanx,
> Judy Almendariz
> jla314 at yahoo.com
>  
>  
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
-- 
Robert C. Ramsdell III
5528 Middaugh Avenue
Downers Grove, IL 60516
(630) 435-1776
rcriii at ramsdells.net



More information about the Chicago mailing list