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.
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 **
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.