Python Programming for the Absolute Beginner, 3rd Edition
The Critter Caretaker program charges the user with the care of his or her own virtual pet. The user names the critter and is completely responsible for keeping it happy, which is no small task. The user must feed and play with the critter to keep it in a good mood. The user can listen to the critter to learn how the critter is feeling, which can range from happy to mad. Figures 8.1 through 8.3 show off the Critter program.
Though you could create this program without software objects, I created the critter as an object. Ultimately, this makes the program easier to work with and modify. Plus, it allows for painless scaling. Once you've created one critter, it's no sweat to create and manage a dozen. Could a critter farm be far off? (Not if you check the chapter challenges.)
Категории