Python Workout

Book description

The only way to master a skill is to practice. In Python Workout, author Reuven M. Lerner guides you through 50 carefully selected exercises that invite you to flex your programming muscles. As you take on each new challenge, you'll build programming skill and confidence. The thorough explanations help you lock in what you've learned and apply it to your own projects. Along the way, Python Workout provides over four hours of video instruction walking you through the solutions to each exercise and dozens of additional exercises for you to try on your own.

About the Technology
To become a champion Python programmer you need to work out, building mental muscle with your hands on the keyboard. Each carefully selected exercise in this unique book adds to your Python prowess—one important skill at a time.

About the Book
Python Workout presents 50 exercises that focus on key Python 3 features. In it, expert Python coach Reuven Lerner guides you through a series of small projects, practicing the skills you need to tackle everyday tasks. You'll appreciate the clear explanations of each technique, and you can watch Reuven solve each exercise in the accompanying videos.

What's Inside
  • 50 hands-on exercises and solutions
  • Coverage of all Python data types
  • Dozens more bonus exercises for extra practice


About the Reader
For readers with basic Python knowledge.

About the Author
Reuven M. Lerner teaches Python and data science to companies around the world.

Quotes
Whether you’re a Python novice or, like me, have been away from the language for a while, this book is a great way to build strength with Python.
- Mark Elston, Advantest America

A practical introduction to the Python programming language, built around fun and well-chosen exercises.
- Jens Christian Bredahl Madsen, Systematic

The practical course you need to become fluent in Pythonic programming!
- Jean-François Morin, Laval University

This book pulls back the layers and allows you to master Python.
- Jeff Smith, Agilify Automation

Publisher resources

View/Submit Errata

Table of contents

  1. Python Workout
  2. Copyright
  3. dedication
  4. brief contents
  5. contents
  6. front matter
    1. preface
    2. acknowledgments
    3. about this book
      1. Who should read this book
      2. How this book is organized: a roadmap
      3. About the code
      4. Software/hardware requirements
      5. liveBook discussion forum
    4. about the author
    5. about the cover illustration
  7. 1 Numeric types
    1. Useful references
    2. Exercise 1 ■ Number guessing game
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 2 ■ Summing numbers
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 3 ■ Run timing
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 4 ■ Hexadecimal output
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Summary
  8. 2 Strings
    1. Useful references
    2. Exercise 5 ■ Pig Latin
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 6 ■ Pig Latin sentence
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 7 ■ Ubbi Dubbi
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 8 ■ Sorting a string
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Summary
  9. 3 Lists and tuples
    1. Exercise 9 ■ First-last
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 10 ■ Summing anything
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 11 ■ Alphabetizing names
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 12 ■ Word with most repeated letters
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 13 ■ Printing tuple records
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Summary
  10. 4 Dictionaries and sets
    1. Hashing and dicts
    2. Sets
    3. Exercise 14 ■ Restaurant
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 15 ■ Rainfall
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 16 ■ Dictdiff
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Exercise 17 ■ How many different numbers?
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    7. Summary
  11. 5 Files
    1. Exercise 18 ■ Final line
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 19 ■ /etc/passwd to dict
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 20 ■ Word count
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 21 ■ Longest word per file
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 22 ■ Reading and writing CSV
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Exercise 23 ■ JSON
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    7. Exercise 24 ■ Reverse lines
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    8. Summary
  12. 6 Functions
    1. Exercise 25 ■ XML generator
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 26 ■ Prefix notation calculator
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 27 ■ Password generator
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Summary
  13. 7 Functional programming with comprehensions
    1. Exercise 28 ■ Join numbers
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 29 ■ Add numbers
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 30 ■ Flatten a list
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 31 ■ Pig Latin translation of a file
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 32 ■ Flip a dict
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Exercise 33 ■ Transform values
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    7. Exercise 34 ■ (Almost) supervocalic words
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    8. Exercise 35a ■ Gematria, part 1
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    9. Exercise 35b ■ Gematria, part 2
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    10. Summary
  14. 8 Modules and packages
    1. Exercise 36 ■ Sales tax
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 37 ■ Menu
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Summary
  15. 9 Objects
    1. Exercise 38 ■ Ice cream scoop
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 39 ■ Ice cream bowl
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 40 ■ Bowl limits
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 41 ■ A bigger bowl
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 42 ■ FlexibleDict
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Exercise 43 ■ Animals
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    7. Exercise 44 ■ Cages
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    8. Exercise 45 ■ Zoo
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    9. Summary
  16. 10 Iterators and generators
    1. Exercise 46 ■ MyEnumerate
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    2. Exercise 47 ■ Circle
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    3. Exercise 48 ■ All lines, all files
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    4. Exercise 49 ■ Elapsed since
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    5. Exercise 50 ■ MyChain
      1. Working it out
      2. Solution
      3. Screencast solution
      4. Beyond the exercise
    6. Summary
    7. Conclusion
  17. index

Product information

  • Title: Python Workout
  • Author(s): Reuven M. Lerner
  • Release date: July 2020
  • Publisher(s): Manning Publications
  • ISBN: 9781617295508