Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python You Can't Handle the Truth!

Concept: Truthy and Falsey in Python

I've seen the concepts of Truthy and Falsey in the JavaScript track...and I barely understand them in that context: https://teamtreehouse.com/community/the-video-about-javascript-was-very-confusing-about-falseys-and-truthys-is-there-any-way-to-make-it-less-confusing

However, it seems like, at least from the "You Can't Handle the Truth!" video, that Python's truthy and falsey might be different. It seems like they're more literal? Like Kenneth seemed to be interchanging calling something True and Truthy...almost as if Truthy was a quality of True. So can something in Python be True but have Falsey characteristics? I'm basically checking to make sure that I understand that the concept of Truthy/Falsey here is the same as the concept Truthy/Falsey from JavaScript. Thanks!

*Note: I'm a beginner; therefore, please respond in a simple, straight forward manner. Thanks!

3 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

They are pretty much the same, yes. However, where python might use "None" JavaScript will use "undefined" or "null". But yes, the idea is the same. Here's a list on python falsey values: https://docs.python.org/2.4/lib/truth.html

And here's a link to one I found on stack overflow for JavaScript. http://stackoverflow.com/questions/19839952/all-falsey-values-in-javascript

Sean Flanagan
Sean Flanagan
33,234 Points

As far as I'm concerned, it's just True and False.

Kevin Ohlsson
Kevin Ohlsson
4,547 Points

It seemed to me that Kenneth implied that 'truthy' is something along the lines of “not always true” ? and Falsey something along the lines of “not always false”?

But that's incorrect, right?

Truthy = True. Truthy means True always.. right?

Falsey = False. Falsey means False always.. right?