liveBook · Manning

What you will learn in Python Workout, Second Edition

200 ten-minute exercises

by Reuven M. Lerner

Chapter by chapter

Chapter 1: Improving your Python with practice

1.1 The role of exercises · 1.2 Scope and goal · 1.3 What’s in the book? · 1.4 What do you need? · 1.5 What about AI?

What you learn in chapter 1 →

Chapter 2: Numeric types

2.2 Exercise 1 ■ Number guessing game · 2.3 Working it out · 2.4 Solution · 2.5 Beyond the exercise · 2.6 Exercise 2 ■ Summing numbers · 2.7 Working it out · 2.8 Solution · 2.9 Beyond the exercise · 2.10 Exercise 3 ■ Run timing · 2.11 Working it out · 2.12 Solution · 2.13 Beyond the exercise · 2.14 Exercise 4 ■ Hexadecimal output · 2.15 Working it out · 2.16 Solution · 2.17 Beyond the exercise · 2.18 Summary

What you learn in chapter 2 →

Chapter 3: Strings

3.2 Exercise 5 ■ Pig Latin · 3.3 Working it out · 3.4 Solution · 3.5 Beyond the exercise · 3.6 Exercise 6 ■ Pig Latin sentence · 3.7 Working it out · 3.8 Solution · 3.9 Beyond the exercise · 3.10 Exercise 7 ■ Ubbi Dubbi · 3.11 Working it out · 3.12 Solution · 3.13 Beyond the exercise · 3.14 Exercise 8 ■ Sorting a string · 3.15 Working it out · 3.16 Solution · 3.17 Beyond the exercise · 3.18 Summary

What you learn in chapter 3 →

Chapter 4: Lists and tuples

4.2 Exercise 9 ■ First-last · 4.3 Working it out · 4.4 Solution · 4.5 Beyond the exercise · 4.6 Exercise 10 ■ Summing anything · 4.7 Working it out · 4.8 Solution · 4.9 Beyond the exercise · 4.10 Exercise 11 ■ Alphabetizing countries · 4.11 Working it out · 4.12 Solution · 4.13 Beyond the exercise · 4.14 Exercise 12 ■ Word with most repeated letters · 4.15 Working it out · 4.16 Solution · 4.17 Beyond the exercise · 4.18 Exercise 13 ■ Printing tuple records · 4.19 Working it out · 4.20 Solution · 4.21 Beyond the exercise · 4.22 Summary

What you learn in chapter 4 →

Chapter 5: Dictionaries and sets

5.1 Hashing and dicts · 5.2 Sets · 5.4 Exercise 14 ■ Restaurant · 5.5 Working it out · 5.6 Solution · 5.7 Beyond the exercise · 5.8 Exercise 15 ■ Rainfall · 5.9 Working it out · 5.10 Solution · 5.11 Beyond the exercise · 5.12 Exercise 16 ■ Dictdiff · 5.13 Working it out · 5.14 Solution · 5.15 Beyond the exercise · 5.16 Exercise 17 ■ How many different numbers? · 5.17 Working it out · 5.18 Solution · 5.19 Beyond the exercise · 5.20 Summary

What you learn in chapter 5 →

Chapter 6: Files

6.2 Exercise 18 ■ Final line · 6.3 Working it out · 6.4 Solution · 6.5 Beyond the exercise · 6.6 Exercise 19 ■ /etc/passwd to dict · 6.7 Working it out · 6.8 Solution · 6.9 Beyond the exercise · 6.10 Exercise 20 ■ Word count · 6.11 Working it out · 6.12 Solution · 6.13 Beyond the exercise · 6.14 Exercise 21 ■ Longest word per file · 6.15 Working it out · 6.16 Solution · 6.17 Beyond the exercise · 6.18 Exercise 22 ■ Reading and writing CSV · 6.19 Working it out · 6.20 Solution · 6.21 Beyond the exercise · 6.22 Exercise 23 ■ JSON · 6.23 Working it out · 6.24 Solution · 6.25 Beyond the exercise · 6.26 Exercise 24 ■ Reverse lines · 6.27 Working it out · 6.28 Solution · 6.29 Beyond the exercise · 6.30 Summary

What you learn in chapter 6 →

Chapter 7: Functions

7.1 Useful references · 7.2 Exercise 25 ■ XML generator · 7.3 Working it out · 7.4 Solution · 7.5 Beyond the exercise · 7.6 Exercise 26 ■ Prefix notation calculator · 7.7 Working it out · 7.8 Solution · 7.9 Beyond the exercise · 7.10 Exercise 27 ■ Password generator · 7.11 Working it out · 7.12 Solution · 7.13 Beyond the exercise · 7.14 Summary

What you learn in chapter 7 →

Chapter 8: Functional programming with comprehensions

8.2 Exercise 28 ■ Join numbers · 8.3 Working it out · 8.4 Solution · 8.5 Beyond the exercise · 8.6 Exercise 29 ■ Add numbers · 8.7 Working it out · 8.8 Solution · 8.9 Beyond the exercise · 8.10 Exercise 30 ■ Flatten a list · 8.11 Working it out · 8.12 Solution · 8.13 Beyond the exercise · 8.14 Exercise 31 ■ Pig Latin translation of a file · 8.15 Working it out · 8.16 Solution · 8.17 Beyond the exercise · 8.18 Exercise 32 ■ Flip a dict · 8.19 Working it out · 8.20 Solution · 8.21 Beyond the exercise · 8.22 Exercise 33 ■ Transform values · 8.23 Working it out · 8.24 Solution · 8.25 Beyond the exercise · 8.26 Exercise 34 ■ (Almost) supervocalic words · 8.27 Working it out · 8.28 Solution · 8.29 Beyond the exercise · 8.30 Exercise 35a ■ Gematria, part 1 · 8.31 Working it out · 8.32 Solution · 8.33 Beyond the exercise · 8.34 Exercise 35b ■ Gematria, part 2 · 8.35 Working it out · 8.36 Solution · 8.37 Beyond the exercise · 8.38 Summary

What you learn in chapter 8 →

Chapter 9: Modules and packages

9.1 Useful references · 9.2 Exercise 36 ■ Sales tax · 9.3 Working it out · 9.4 Solution · 9.5 Beyond the exercise · 9.6 Exercise 37 ■ Menu · 9.7 Working it out · 9.8 Solution · 9.9 Beyond the exercise · 9.10 Summary

What you learn in chapter 9 →

Chapter 10: Objects

10.1 What are objects, anyway? · 10.2 Why use objects? · 10.3 Practicing with objects · 10.5 Exercise 38 ■ Ice cream scoop · 10.6 Working it out · 10.7 Solution · 10.8 Beyond the exercise · 10.9 Exercise 39 ■ Ice cream bowl · 10.10 Working it out · 10.11 Solution · 10.12 Beyond the exercise · 10.13 Exercise 40 ■ Bowl limits · 10.14 Working it out · 10.15 Solution · 10.16 Beyond the exercise · 10.17 Exercise 41 ■ A bigger bowl · 10.18 Working it out · 10.19 Solution · 10.20 Beyond the exercise · 10.21 Exercise 42 ■ FlexibleDict · 10.22 Working it out · 10.23 Solution · 10.24 Beyond the exercise · 10.25 Exercise 43 ■ Animals · 10.26 Working it out · 10.27 Solution · 10.28 Beyond the exercise · 10.29 Exercise 44 ■ Cages · 10.30 Working it out · 10.31 Solution · 10.32 Beyond the exercise · 10.33 Exercise 45 ■ Zoo · 10.34 Working it out · 10.35 Solution · 10.36 Beyond the exercise · 10.37 Summary

What you learn in chapter 10 →

Chapter 11: Iterators and generators

11.1 What is a for loop? · 11.2 Python’s iteration protocol · 11.3 Making your class iterable · 11.4 Other iterators · 11.5 Useful references · 11.6 Exercise 46 ■ MyEnumerate · 11.7 Working it out · 11.8 Solution · 11.9 Beyond the exercise · 11.10 Exercise 47 ■ Circle · 11.11 Working it out · 11.12 Solution · 11.13 Beyond the exercise · 11.14 Exercise 48 ■ All lines, all files · 11.15 Working it out · 11.16 Solution · 11.17 Beyond the exercise · 11.18 Exercise 49 ■ Elapsed since · 11.19 Working it out · 11.20 Solution · 11.21 Beyond the exercise · 11.22 Exercise 50 ■ MyChain · 11.23 Working it out · 11.24 Solution · 11.25 Beyond the exercise · 11.26 Summary · 11.27 Conclusion

What you learn in chapter 11 →

Chapter 12: Where to from here?

12.1 What next? · 12.2 Keep in touch

What you learn in chapter 12 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.