Python Brain Teasers: Exercise Your Mind

Tebeka, Miki

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2021-09-28
  • 定價: $850
  • 售價: 9.5$808
  • 貴賓價: 9.0$765
  • 語言: 英文
  • 頁數: 118
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1680509004
  • ISBN-13: 9781680509007
  • 相關分類: Python程式語言
  • 立即出貨 (庫存 < 3)

買這商品的人也買了...

相關主題

商品描述

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.

What You Need:

  • You need to know Python at some level and have experience programming with it.
  • NOTE: The book uses Python version 3.8.2 to run the code; the output _could_ change in future versions.
  • You will need a working Python environment, you can download it from python.org: https: //www.python.org/downloads/.
  • You will probably want a good IDE for python, two of the most popular ones are Visual Studio Code: https: //code.visualstudio.com/ and PyCharm: https: //www.jetbrains.com/pycharm/.

商品描述(中文翻譯)

我們這些技術愛好者喜歡解謎和解決問題。Python 程式語言是一種簡單的語言,但像其他語言一樣,它也有一些怪癖。這本書利用這些怪癖作為教學機會,通過 30 個簡單的 Python 程式挑戰你對 Python 的理解。這些謎題將幫助你避免錯誤,發現知識上的空白,並讓你在所做的事情上變得更好。你可以利用這些謎題來給同事留下深刻印象,或者在無聊的會議中打發時間。謎題很有趣!

在每個章節的開頭,我會給你展示一個簡短的 Python 程式,然後要求你猜測輸出結果。可能的答案有:

- 語法錯誤
- 例外情況
- 卡住
- 一些輸出(例如 [1 2 3])

以下是解決這些謎題的方法。先閱讀程式碼,然後在查看答案和解釋之前,試著猜測輸出結果。猜測完輸出結果後,執行程式碼並查看輸出結果。最後,再閱讀解決方案和解釋。這些謎題足夠短,可以在喝咖啡休息時解決,所以隨身攜帶它們,享受樂趣,並與同事分享。

在學習過程中犯錯的人比不犯錯的人學得更好。如果你在工作中修復錯誤時使用這種方法,你會發現你會更喜歡尋找錯誤,並在修復每個錯誤後成為一個更好的開發者。

這些謎題中的許多都來自作者在生產環境中發生錯誤的經驗教訓(以及其他人的經驗)。他經常在會議和聚會中使用這些謎題作為測驗題,並且它們往往引起了一陣興奮。

你需要準備的東西:

- 你需要在某個程度上了解 Python,並有使用它進行編程的經驗。
- 注意:本書使用 Python 3.8.2 版本運行程式碼;輸出結果在未來版本中可能會有所變化。
- 你需要一個可運行 Python 的環境,你可以從 python.org 下載:https://www.python.org/downloads/。
- 你可能需要一個好的 Python 集成開發環境(IDE),其中兩個最受歡迎的是 Visual Studio Code:https://code.visualstudio.com/ 和 PyCharm:https://www.jetbrains.com/pycharm/。

作者簡介

Miki has a passion for teaching and mentoring. He teaches many workshops on various technical subjects all over the world and also mentored many young developers on their way to success. Miki is involved in open source, has several projects of his own, and contributed to several more - including the Python project. He has been using Python for more than 23 years.

作者簡介(中文翻譯)

Miki熱衷於教學和指導。他在世界各地教授許多關於不同技術主題的工作坊,並且也指導許多年輕開發者走向成功。Miki參與開源項目,擁有自己的幾個項目,並且對其他項目也做出了貢獻,包括Python項目。他已經使用Python超過23年了。