Crazy Python Puzzle (Tuple Confusion)

In this article, you’ll study a beautiful Python puzzle which was created by my friend and co-author Lukas.

When I saw this puzzle the first time, I was very lazy about it. I looked at the puzzle and immediately threw my answer into Lukas’ face.

It was so obvious…

But Lukas kept smiling and I began to wonder whether I committed too fast to a solution. This always happened to me in chess when I solved seemingly simple “chess puzzles” – and failed.

The coding game is won by the patient who carefully examines code. Over the years, I learned this lesson the hard way (hundreds of hours debugging stupid mistakes)!

Ok, so here it is:

# Code Puzzle

my_tuple = 1, 1, 1 == (1, 1, 1)
print(my_tuple)

What’s the output of this code puzzle?
As usual, check out the correct answer and track your learning progress on the Finxter app.

Happy puzzling!
Chris

PS: Thanks for the great response about the Python style checker. I’ve included some of your feedback today.

Check out the current version and tell me how you like it!

** PythonChecker Makes Your Code Great Again **

Leave a Comment

Your email address will not be published. Required fields are marked *