Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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,235 Points

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

Kevin Ohlsson
Kevin Ohlsson
4,559 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?