[Tutor] the 'or' attribute

Leung Cris krazie_mu_boi at hotmail.com
Tue Dec 9 20:41:50 EST 2003


Umm....okay , I get it. So, how can i have a variable that stores ' this number, or that number' ?

>From: <tpc at csua.berkeley.edu>
>To: Leung Cris <krazie_mu_boi at hotmail.com>
>CC: <tutor at python.org>
>Subject: Re: [Tutor] the 'or' attribute
>Date: Tue, 9 Dec 2003 16:58:36 -0800 (PST)
>
>
>hi Cris, the Python 'or' operator returns y if x is false,
>so:
>
>w = x or y
>print w
>
>will yield x if x is true.  For Python truth value testing check out:
>
>http://www.python.org/doc/current/lib/boolean.html#l2h-102
>
>and for more on the 'or' operator:
>
>http://www.python.org/doc/current/lib/boolean.html#l2h-102
>
>I hope that helps you.
>
>  On Tue, 9 Dec 2003, Leung Cris wrote:
>
> > How do i use 'or' ? for e.g , i tried
> >
> >  x = 1 or 2
> > print x
> >
> > it would always print 1, and never two. Why is that?
> >
> > _________________________________________________________________
> > ¨Ï¥Î MSN Messenger¡A»PªB¤Í¦b½u¤W²á¤Ñ: http://messenger.microsoft.com/tc
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>

_________________________________________________________________
¨Ï¥Î MSN Messenger¡A»PªB¤Í¦b½u¤W²á¤Ñ: http://messenger.microsoft.com/tc 




More information about the Tutor mailing list