osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Test 0 and false since false is 0


I was trying to solve a problem and cannot determine how to filter 0's but
not false.


I'm typing on my phone so can't paste a session, so I will attempt to apply
the Socratic method, and ask: Do you understand why your attempts have
failed so far? In what way are False and 0 the same? In what respects do
they differ? Hint: think class relationships.

Not trying to be difficult. Just thought I'd change things up a bit. If you
come away with a bit deeper appreciation of Python's type system, you'll be
a bit better off down the road.

Skip