Skip to Main Content
Invent Your Own Computer Games with Python , 4th Edition
book

Invent Your Own Computer Games with Python , 4th Edition

by Al Sweigart
December 2016
Intermediate to advanced content levelIntermediate to advanced
376 pages
9h 5m
English
No Starch Press
Content preview from Invent Your Own Computer Games with Python , 4th Edition

3GUESS THE NUMBER

image

In this chapter, you’re going to make a Guess the Number game. The computer will think of a secret number from 1 to 20 and ask the user to guess it. After each guess, the computer will tell the user whether the number is too high or too low. The user wins if they can guess the number within six tries.

This is a good game to code because it covers many programming concepts in a short program. You’ll learn how to convert values to different data types and when you would need to do this. Since this program is a game, from now on we’ll call the user the player.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Art of Computer Programming, The: Volume 1: Fundamental Algorithms, 3rd Edition

Art of Computer Programming, The: Volume 1: Fundamental Algorithms, 3rd Edition

Donald E. Knuth
Expert Python Programming – Fourth Edition - Fourth Edition

Expert Python Programming – Fourth Edition - Fourth Edition

Michał Jaworski, Tarek Ziade, Tarek Ziadé

Publisher Resources

ISBN: 9781492019152Errata Page