This course will be retired on June 22, 2018. We recommend "Python Basics" for up-to-date content.
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Number Game Takeaways1:15 with Kenneth Love
Like the shopping list, this game helped cement a few more concepts.
While still simple compared to a lot of software, this game is pretty solid. We've covered
- Conditions for execution (limiting the number of guesses)
- Logic for feedback (too high/too low)
- Restarting the game
- And handling exceptions for bad numbers
Our number game won't win any game industry awards, but
it taught us a lot about programming and Python.
As simple as it is, here are some of the major things to pick up from it.
We can, and should, catch explicit exceptions when doing conversions,
or anything else that might backfire.
It's easy to do, and it makes our code cleaner.
Imports give us a lot more functionality.
Using what the standard library provides,
means we don't have to write all of the features ourselves.
And, like with our shopping app, a bit of better feedback and
interaction makes the experience a lot better.
This is especially nice for getting to play multiple games.
Building little games like this is a great way to explore things like the random
library since you often want random choices and events in your games.
In fact we'll be exploring the random library a little bit more
in the next stage too.
Before we get there,
consider this my usual advice to get some rest and have a snack.
Absorb all the cool stuff we just did.
Also, if you want to try a little more practice,
try the build the opposite version of this game.
You think of a number.
Have the computer make a guess and then adjust that guess
based on whether you tell that the number was too high or too low.
This will be harder than the version we built but I'm sure that you can do it.
You need to sign up for Treehouse in order to download course files.Sign up