Coffee Break Python Workbook
Coffee Break Python Workbook
$19.99
Minimum price
$39.99
Suggested price
Coffee Break Python Workbook

This book is 100% complete

Completed on 2019-10-21

About the Book

Puzzle-based Learning Python

This book is the chess grandmaster way of learning Python. It offers you 127 unique and brand-new Python puzzles. Every puzzle points to gaps in your knowledge, challenges you to guess a solution, and then explains potential solutions, in an easy-to-understand manner:

~~~

# Here’s one example puzzle:

my_list = [1, 1, 1, 1]

my_list[1::2] = [2, 3]

print(my_list)

# What’s the output of this code snippet?

~~~

An easy, fun, and effective way of learning Python -- day after day -- in your COFFEE BREAK PYTHON!

Here's what research says about puzzle-based learning:

"Students who were quizzed after studying a short text could recall significantly more information than students who were asked to reread it"

-- Karpicke, 2007, Elsevier Journal of Memory and Language

Practice testing is scientifically proven to generate up to 44% better learning retention and efficiency.

Simply put: quizzes and puzzles work! More than 100,000 Finxters and thousands of "Coffee Break Python" book customers have already successfully improved their skills with code puzzles.

Learning does not happen in a linear and orderly manner. It's a probabilistic, chaotic, and iterative process of creating knowledge gaps in your brain -- and filling them with just the right information you need.

That's the premise of the "Coffee Break Python" textbook series.

What will you get out of the book?

  • Improve your level of deep Python code understanding.
  • Surprise your peers with your newly acquired code speed reading skills.
  • Enjoy the small daily doses of intellectual challenges. A Finxter once called it "Sudoku for coders"! ;)
  • Improve your brain's working memory by hammering down the most important concepts.
  • Learn all the basic Python syntax elements.
  • Discover your own skill level by tracking your puzzle-solving performance.
  • Compare your skill level against other coders: are you a grandmaster of code?
  • Enjoy the fun of rushing over Python -- from "hello world" to "recursive Quicksort".
  • Get the best of all Finxter Python cheat sheets to revive 80% of the Python features in 20% of the time.
  • Get your dream job and rock future code interviews!

And take one step forward mastering the most popular programming language ON THE PLANET!

About the Authors

Christian Mayer
Christian Mayer

Christian is working as a doctoral computer science researcher in the area of distributed systems Germany. He taught numerous students in computer science, graph theory, and distributed systems. His passions are writing, reading, and coding. Christian's mission is to serve aspiring coders through Finxter and help them to boost their skills.

Lukas Rieger
Lukas Rieger

I love coding and espacially in Python! Python is easy to learn and at the same time it is very powerful. Through the books I would like to help you to discover this! Therefore we designed our puzzle based teaching approach which helps you to learn quickly what you really need and with fun.

I have been working as a Software developer for several years. Currently I'm in the field of operations/SRE of cloud applications.

Bundles that include this book

Coffee Break Python
Coffee Break Python Slicing
Coffee Break NumPy
Coffee Break Python Workbook
$114.92
Suggested Price
$49.99
Bundle Price
Coffee Break Python
Coffee Break Python Slicing
Coffee Break NumPy
Coffee Break Python Workbook
Brain Games Python
$154.91
Suggested Price
$59.99
Bundle Price

Reader Testimonials

Vlad Bezden, Software engineer
Vlad Bezden, Software engineer

I love it!

Thank you. I love it :) I enjoy reading this book! Keep up the good work.

Albrecht, German Workbook Reader
Albrecht, German Workbook Reader

Great Book!

"A great book, I've learned a lot and marked every​ knowledge gap​ ​[...] Thank you very much!"

Table of Contents

1 Introduction 1

2 A Case for Puzzle-based Learning 5

2.1 Overcome the Knowledge Gap . . . . . . . 6

2.2 Embrace the Eureka Moment . . . . . . . 7

2.3 Divide and Conquer . . . . . . . . . . . . 8

2.4 Improve From Immediate Feedback . . . . 9

2.5 Measure Your Skills . . . . . . . . . . . . . 10

2.6 Individualized Learning . . . . . . . . . . . 12

2.7 Small is Beautiful . . . . . . . . . . . . . . 12

2.8 Active Beats Passive Learning . . . . . . . 14

2.9 Make Code a First-class Citizen . . . . . . 16

2.10 What You See is All There is . . . . . . . 18

3 The Elo Rating for Python 21

3.1 How to Use This Book . . . . . . . . . . . 21

3.2 How to Test and Train Your Skills? . . . . 23

3.3 What Can This Book Do For You? . . . . 27

4 A Quick Overview of the Python Language 31

4.1 Keywords . . . . . . . . . . . . . . . . . . 32

4.2 Basic Data Types . . . . . . . . . . . . . . 35

4.3 Complex Data Types . . . . . . . . . . . . 38

4.4 Classes . . . . . . . . . . . . . . . . . . . . 43

4.5 Functions and Tricks . . . . . . . . . . . . 46

5 Puzzles: Basic to Scholar 51

5.1 Printing values . . . . . . . . . . . . . . . 51

5.2 Basics of variables . . . . . . . . . . . . . . 53

5.3 Getting started with strings . . . . . . . . 54

5.4 Types of variables I . . . . . . . . . . . . . 55

5.5 Types of Variables II . . . . . . . . . . . . 56

5.6 Minimum . . . . . . . . . . . . . . . . . . 57

5.7 String Concatenation . . . . . . . . . . . . 58

5.8 Line Breaks I . . . . . . . . . . . . . . . . 59

5.9 Line Breaks II . . . . . . . . . . . . . . . . 60

5.10 List Length . . . . . . . . . . . . . . . . . 61

5.11 Comparison Operators I . . . . . . . . . . 62

5.12 Comparison Operators II . . . . . . . . . . 63

5.13 Multiple Initializations . . . . . . . . . . . 64

6 Puzzles: Scholar to Intermediate 67

6.1 Maximum . . . . . . . . . . . . . . . . . . 67

6.2 Memory addresses . . . . . . . . . . . . . . 68

6.3 Swapping Values . . . . . . . . . . . . . . 69

6.4 The Boolean Operator AND . . . . . . . . 70

6.5 The Boolean Operator OR . . . . . . . . . 72

6.6 Boolean Operators . . . . . . . . . . . . . 74

6.7 Arithmetic Expressions . . . . . . . . . . . 76

6.8 Integer Division and Modulo . . . . . . . . 78

6.9 Building Strings . . . . . . . . . . . . . . . 80

6.10 The len() Function . . . . . . . . . . . . 81

6.11 String Indices . . . . . . . . . . . . . . . . 82

6.12 The upper() Function . . . . . . . . . . . . 83

6.13 The lower() Function . . . . . . . . . . . . 84

6.14 Somebody Is Shouting . . . . . . . . . . . 85

6.15 Counting Characters . . . . . . . . . . . . 86

6.16 String Lengths . . . . . . . . . . . . . . . 87

6.17 Finding Characters in Strings . . . . . . . 88

6.18 Not Finding Characters in Strings . . . . . 89

6.19 Counting Letters . . . . . . . . . . . . . . 90

6.20 Min() and Max() of a String . . . . . . . . 91

6.21 Reversed Strings . . . . . . . . . . . . . . 92

6.22 String Equality . . . . . . . . . . . . . . . 93

6.23 Slicing I . . . . . . . . . . . . . . . . . . . 95

6.24 Slicing II . . . . . . . . . . . . . . . . . . . 96

6.25 Slicing III . . . . . . . . . . . . . . . . . . 97

6.26 Slicing IV . . . . . . . . . . . . . . . . . . 98

6.27 Slicing V . . . . . . . . . . . . . . . . . . . 99

6.28 Memory Addresses and Slicing . . . . . . . 100

6.29 Accessing List Items I . . . . . . . . . . . 101

6.30 Accessing List Items II . . . . . . . . . . . 103

6.31 List as Stack . . . . . . . . . . . . . . . . . 104

6.32 More String Operations . . . . . . . . . . 105

6.33 Checking for Substrings . . . . . . . . . . 106

6.34 Stripping String Boundaries . . . . . . . . 107

6.35 Strings: Stripping vs. Replacement . . . . 108

6.36 Glueing Strings Together . . . . . . . . . . 109

6.37 The Copy Operation . . . . . . . . . . . . 110

6.38 Growing List Contents I . . . . . . . . . . 111

6.39 Growing List Contents II . . . . . . . . . . 112

6.40 List Operations I . . . . . . . . . . . . . . 114

6.41 List Operations II . . . . . . . . . . . . . . 115

6.42 List Operations III . . . . . . . . . . . . . 116

6.43 List Operations IV . . . . . . . . . . . . . 117

6.44 List Operations V . . . . . . . . . . . . . . 117

6.45 List Operations VI . . . . . . . . . . . . . 118

6.46 List Operations VII . . . . . . . . . . . . . 119

6.47 List Operations VIII . . . . . . . . . . . . 120

6.48 List Operations IX . . . . . . . . . . . . . 121

6.49 List Operations X . . . . . . . . . . . . . . 122

6.50 Lists and the Range Function I . . . . . . 123

6.51 Lists and the Range Function II . . . . . . 124

6.52 Lists and the Range Function III . . . . . 125

6.53 Python’s Multiple Assignment I . . . . . . 126

6.54 Slice Assignments . . . . . . . . . . . . . . 127

6.55 Strings and Lists II . . . . . . . . . . . . . 128

6.56 String Comparisons . . . . . . . . . . . . . 129

6.57 From Booleans to Strings . . . . . . . . . . 130

6.58 Boolean Trickery I . . . . . . . . . . . . . 131

6.59 Boolean Trickery II . . . . . . . . . . . . . 132

6.60 Boolean Trickery III . . . . . . . . . . . . 133

6.61 Looping over Ranges . . . . . . . . . . . . 134

6.62 Reversed Loops . . . . . . . . . . . . . . . 135

6.63 Boolean Trickery IV . . . . . . . . . . . . 136

6.64 Lists and Memory Addresses . . . . . . . . 137

6.65 List Objects . . . . . . . . . . . . . . . . . 138

6.66 Boolean Tricks . . . . . . . . . . . . . . . 139

6.67 Complex Numbers . . . . . . . . . . . . . 140

6.68 Tuples . . . . . . . . . . . . . . . . . . . . 141

6.69 Multiple Assignments . . . . . . . . . . . . 142

6.70 Boolean Integer Conversion . . . . . . . . 143

6.71 The any() Function . . . . . . . . . . . . 144

6.72 The sum() Function . . . . . . . . . . . . 146

6.73 Accessing Complex Numbers . . . . . . . . 148

6.74 Tuple Confusion . . . . . . . . . . . . . . . 149

6.75 Understanding While ... Else (1/3) . . . . 150

6.76 Understanding While ... Else (2/3) . . . . 151

6.77 Understanding While ... Else (3/3) . . . . 153

6.78 Basic Arithmetic . . . . . . . . . . . . . . 155

6.79 Dictionary . . . . . . . . . . . . . . . . . . 156

6.80 Dictionary of Dictionaries . . . . . . . . . 158

6.81 Reverse Dictionary Index . . . . . . . . . . 160

6.82 Default Arguments . . . . . . . . . . . . . 162

7 Puzzles: Intermediate to Professional 165

7.1 Building Strings II . . . . . . . . . . . . . 165

7.2 String: Slicing and Indexing . . . . . . . . 167

7.3 Built-in Python Operations . . . . . . . . 168

7.4 Strings and Lists I . . . . . . . . . . . . . 169

7.5 Formatting Printouts . . . . . . . . . . . . 170

7.6 Floating Point Comparisons . . . . . . . . 172

7.7 Python’s Multiple Assignment II . . . . . 174

7.8 The Not-So-Obvious Case . . . . . . . . . 175

7.9 Rounding Values . . . . . . . . . . . . . . 176

7.10 Initializing Integers . . . . . . . . . . . . . 177

7.11 Basic Typing . . . . . . . . . . . . . . . . 178

7.12 Short Circuiting . . . . . . . . . . . . . . . 179

7.13 While Arithmetic . . . . . . . . . . . . . . 182

7.14 The Lambda Function . . . . . . . . . . . 183

7.15 Zip . . . . . . . . . . . . . . . . . . . . . . 184

7.16 Basic Filtering . . . . . . . . . . . . . . . . 186

7.17 List Comprehension . . . . . . . . . . . . . 188

7.18 Encryption by Obfuscation . . . . . . . . . 190

7.19 String Dictionary . . . . . . . . . . . . . . 193

7.20 Lambda Function . . . . . . . . . . . . . . 194

7.21 Dictionary of Dictionaries . . . . . . . . . 196

7.22 Sorting Dictionary Keys . . . . . . . . . . 198

7.23 Pythonic Loop Iteration . . . . . . . . . . 200

7.24 Filtering with List Comprehension . . . . . 202

7.25 Aggregating with List Comprehension . . . 204

7.26 Maximum of Tuples . . . . . . . . . . . . . 206

7.27 The Key Argument . . . . . . . . . . . . . 208

7.28 Puzzle 123 . . . . . . . . . . . . . . . . . . 210

7.29 Set Operations (1/2) . . . . . . . . . . . . 211

7.30 Set Operations (2/2) . . . . . . . . . . . . 212

7.31 Recursive Algorithm . . . . . . . . . . . . 214

7.32 Fibonacci . . . . . . . . . . . . . . . . . . 218

8 Final Remarks 221

Your skill level . . . . . . . . . . . . . . . 221

Where to go from here? . . . . . . . . . . 222

Authors have earned$8,253,833writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub