PROJECT 9

Address Book

In this project you create a basic address book in which you can store your friend’s name, email address, and birthday. Or you can store your friends’ names, email addresses, and birthdays. You know. Some people like to keep a tight circle. You could extend the address book to include anything else about them. Did they borrow your favorite book or a dollar for lunch?

image

To put the address book together, you make your own objects, called classes. These custom (made-by-you) objects are the spine of Python work. In this project, you also see how to store your data in files so you can load your info later.

Your First Class Objects

Address books have a lot of individual entries. The structure of each entry is pretty much the same, although the names are changed (to protect the innocent). You’re going to create your own personalized Python objects (called classes) to reuse for each address book entry by using Python’s class keyword.

You need to know about custom objects (objects you make yourself) to understand the projects at dummies.com/go/pythonforkids.

Earlier when you created a string, Python packed up a heap of string methods for you. When you wrote a ...

Get Python For Kids For Dummies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.