Python Workout: 50 ten-minute exercises

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Python Workout presents 50 exercises designed to deepen the reader's skill with Python. Readers will not only tackle exercises using built-in data structures, but also more advanced techniques, such as functional programming, object-oriented programming, iterators, and generators. With each engaging challenge, readers will practice a new skill and learn how to apply it to everyday coding tasks.

Author(s): Reuven M. Lerner
Edition: 1
Publisher: Manning Publications
Year: 2020

Language: English
Commentary: Vector PDF
Pages: 249
City: Shelter Island, NY
Tags: Programming; Python; Functional Programming; Object-Oriented Programming; Elementary; Entry Level

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