- Saved searches
- Use saved searches to filter your results more quickly
- nphorsley59/python_workout
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- choose your plan
- team
- choose your plan
- pro
- team
- choose your plan
- pro
- team
- about the technology
- about the book
- choose your plan
- team
- choose your plan
- pro
- team
- choose your plan
- pro
- team
- about the technology
- about the book
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
nphorsley59/python_workout
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Exercise 1 — Number guessing game
- Write a function that takes no arguments.
- When run, the function chooses a random integer between 0 and 100 (inclusive).
- Then ask the user to guess what number has been chosen.
- Each time the user enters a guess, the program indicates one of the following:
- Too high
- Too low
- Just right
I built upon the generic solution to this game because I felt like the user experience was lacking. The first improvement I made was to catch non-numeric inputs with a try-except block.
The second improvement I made was to give the «game master» parameters to customize. This included the upper and lower limit of the random integer as well as the number of attempts the user had to correctly guess the number. Note: this technically breaks the rules of the exercise, but the added replay value more than makes up for it.
Exercise 2 — Summing numbers
- Write a function that does the same thing as the built-in sum function.
- Instead of taking a single sequence as a parameter, it should take a variable number of arguments.
- Using the built-in sum function is not allowed.
Writing a solution to the base requirements of this exercise was pretty straight-forward. By prefixing a function parameter with *, it can accept any number of arguments. For fun, I recreated the sum() function exactly (it accepts two parameters, an iterable and a starting point).
I also put it to use in a simple counting task.
choose your plan
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
choose your plan
pro
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
choose your plan
pro
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
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
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.
choose your plan
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
choose your plan
pro
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
choose your plan
pro
- share your subscription with one other person
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
team
- five seats for your team
- access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
- choose another free product every time you renew
- choose twelve free products per year
- exclusive 50% discount on all purchases
- Python Workout ebook for free
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
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.