On Wed, Sep 30, 2009 at 1:32 AM, Luke Paireepinart
wrote:
> Oops, thanks for catching that one Marty. I thought they both
> evaluated to false.
They both evaluate to false in a boolean context but that is different
from being *equal* to false or to each other.
In [1]: s = ''
In [2]: bool(s)
Out
On 9/29/2009 10:32 PM Luke Paireepinart said...
Oops, thanks for catching that one Marty. I thought they both
evaluated to false.
They do when passed to bool --
>>> bool("") == bool([])
True
>>>
___
Tutor maillist - Tutor@python.org
To unsubscribe
On 30/09/2009, at 10:44 AM, Luke Paireepinart wrote:
On Tue, Sep 29, 2009 at 11:40 PM, Corey Richardson
wrote:
I got suggested to use this format for my code, as it was shorter
and prettier. But It dun work!
if wellness != ["Well","Fine","Good", "OK", "ok", "Ok", "Great",
"Awesome", "Ep
Oops, thanks for catching that one Marty. I thought they both
evaluated to false.
On 9/29/09, Martin Walsh wrote:
> Luke Paireepinart wrote:
>> In this case you are saying "is their input equal to this list with many
>> elements?" and the answer is always going to be No because a string
>> won't
Luke Paireepinart wrote:
> In this case you are saying "is their input equal to this list with many
> elements?" and the answer is always going to be No because a string
> won't be equal to a list unless both are empty.
I know you probably didn't mean this as it reads, or as I'm reading it,
but an
> if wellness.strip().lower() in ["well", "fine", "good", "whatever"]:
> note if you strip & lowercase the list it is far more likely you'll match
> your input.
>
> And by "lowercase the list" I meant "lowercase the string" of course :)
___
Tutor maillist
On Tue, Sep 29, 2009 at 11:40 PM, Corey Richardson wrote:
> I got suggested to use this format for my code, as it was shorter and
> prettier. But It dun work!
> if wellness != ["Well","Fine","Good", "OK", "ok", "Ok", "Great", "Awesome",
> "Epic"]:
> print "Oh, I'm sorry you are not feeling well
2009/9/29 Corey Richardson :
> I got suggested to use this format for my code, as it was shorter and
> prettier. But It dun work!
> if wellness != ["Well","Fine","Good", "OK", "ok", "Ok", "Great", "Awesome",
> "Epic"]:
> print "Oh, I'm sorry you are not feeling well."
> areYouOk = raw_input("I
I got suggested to use this format for my code, as it was shorter and
prettier. But It dun work!
if wellness != ["Well","Fine","Good", "OK", "ok", "Ok", "Great",
"Awesome", "Epic"]:
print "Oh, I'm sorry you are not feeling well."
areYouOk = raw_input("I guessed correct, right?")
if areY