# Python Brain Teasers (PragProg)

**URL:** <https://forum.devtalk.com/t/python-brain-teasers-pragprog/956>\
**Category:** Backend Learning Resources\
**Tags:** published-book, pragprog, book-python-brain-teasers, python\
**Created:** [1 July 2020 15:16 UTC](https://forum.devtalk.com/t/python-brain-teasers-pragprog/956 "2020-07-01T15:16:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PragmaticBookshelf](https://forum.devtalk.com/user_avatar/forum.devtalk.com/pragmaticbookshelf/32/463_2.png) [@PragmaticBookshelf](https://forum.devtalk.com/u/PragmaticBookshelf)\
**Post date:** [1 July 2020 15:16 UTC](https://forum.devtalk.com/t/python-brain-teasers-pragprog/956/1 "2020-07-01T15:16:00Z")

</div>

Get ready for 30 teasers that will hone your Python skills and challenge your brain..

 ![d-pybrain-1000](https://forum.devtalk.com/uploads/default/original/2X/6/6c7f825bd77d983433465242d094bcfc8ae84f20.jpeg)

### Miki Tebeka @tebeka

_edited by Margaret Eldridge_ @margaret

We geeks love puzzles and solving them. The Python programming language is a simple one, but like all other languages it has quirks. This book uses those quirks as teaching opportunities via 30 simple Python programs that challenge your understanding of Python. The teasers will help you avoid mistakes, see gaps in your knowledge, and become better at what you do. Use these teasers to impress your co-workers or just to pass the time in those boring meetings. Teasers are fun!

At the beginning of each chapter I’ll show 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.

* * *

- Full details: [https://pragprog.com/titles/d-pybrain/python-brain-teasers/](https://www.pragprog.com/titles/d-pybrain/)
- View this book’s portal and details on how to post errata and suggestions [here](https://devtalk.com/books/python-brain-teasers).

_Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “ **devtalk.com**" at checkout 👍_

---

<div class="post-metadata">

**Author:** ![mafinar](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mafinar/32/723_2.png) [@mafinar](https://forum.devtalk.com/u/mafinar)\
**Post date:** [8 July 2020 21:45 UTC](https://forum.devtalk.com/t/python-brain-teasers-pragprog/956/2 "2020-07-08T21:45:19Z")

</div>

Recently bought it. Really nice teasers, I strongly recommended this book to every Python programmer I know. Also, my first purchase with “[devtalk.com](http://devtalk.com)” promo 😉

---

<div class="post-metadata">

**Author:** ![Margaret](https://forum.devtalk.com/user_avatar/forum.devtalk.com/margaret/32/237_2.png) [@Margaret](https://forum.devtalk.com/u/Margaret)\
**Post date:** [18 November 2020 19:06 UTC](https://forum.devtalk.com/t/python-brain-teasers-pragprog/956/3 "2020-11-18T19:06:29Z")

</div>

Hey everyone! Check out the interview with @tebeka here:

> **[Brain teasers and other fun tips for learning Python](https://searchbusinessanalytics.techtarget.com/feature/Brain-teasers-and-other-fun-tips-for-learning-Python)**
>
> Getting better at coding can be an important part of your career path. Tips for learning Python typically include reading and writing code. But it also can be fun to advance your coding abilities with exercises and brain teasers that test your Python...
