Having trouble reading this email? View it in your browser.
New This Week

Python Brain Teasers »

These 30 simple Python programs will challenge your understanding of Python. The Python programming language is a simple one, but like all other languages, it has its quirks. Learn from these quirks and be a better programmer. Avoid common mistakes and level up your Python skills. We geeks love puzzles and solving them, and now you can learn deeper Python while having fun and impressing your co-workers!

Recently Released:


Best Sellers:

Make sure you haven't missed anything!

  1. Build a Weather Station with Elixir and Nerves
  2. SQL Antipatterns, Volume 1
  3. Programming Phoenix 1.4
  4. Hands-on Rust
  5. Programming Phoenix LiveView

See all best sellers...

Python Brain Teasers
August 31, 2021

Python Brain Teasers: Exercise Your Mind

At the beginning of each chapter the author shows you a short Python program and will ask you to guess the output. The possible answers can be:

  • Syntax error
  • Exception
  • Hang
  • Some output (e.g. [1 2 3])

Here's how to approach the puzzles. Read through the code. Before moving on to the answer and the explanation, go ahead and guess the output. After guessing the output, run the code and see the output yourself. Finally proceed to read the solution and the explanation. The puzzles are short enough to solve on a coffee break, so carry them with you, have fun, and share them with co-workers.

People who make mistakes during the learning process learn better than people who don't. If you use this approach at work when fixing bugs, you'll find you enjoy bug hunting more and become a better developer after each bug you fix.

Many of these puzzles are from the author's lessons learned (and others) of shipping bugs to production. He often uses the puzzles as quizzes during conferences and meetups, and they tend to create a buzz of excitement.

Now in print: Use Coupon Code "PYBRAINCOMPLETE" for 40% off the ebook at pragprog.com/titles/d-pybrain. For the paperback edition, please support your local independent bookstore.

You Could Be a Published Author

Is there a tech topic you are deeply passionate about and want to share with the rest of us? You could become a published Pragmatic Bookshelf author! Take a look at our pragprog.com/become-an-author page for details, including our 50% royalty (yes, for real!) and world-class development editors.

Remember, the best way to tell the future is to create it.

Upcoming Author Appearances

  • 2021-09-14 Johanna Rothman, Festival Agile Trends
  • 2021-09-21 Kenneth Kousen, ApacheCon 2021, online
  • 2021-09-24 Kenneth Kousen, New England Software Symposium, Boston, MA
  • 2021-09-30 Johanna Rothman, Unmute Conference
  • 2021-10-05 Kenneth Kousen, UberConf, Denver, CO
  • 2021-10-09 Michael Fazio, Central WI IT Conference, Virtual/Online
  • Don't Get Left Out

    Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is sign up at pragprog.com.

    Tell your friends! Tweet this

    Follow us on Twitter for the latest news, commentary, and occasional discounts: @pragprog, Andy Hunt @PragmaticAndy.

    Thanks for your continued support,

    By Professional Developers, for Professional Developers

    Sent by the Pragmatic Programmers, LLC. • 9650 Strickland Rd Ste 103-255• Raleigh NC 27615