Putting It All Together: The Address Book Example

In Chapter 4, we used an address book application to demonstrate the if, for, and while statements. We're bringing it back to review the concepts we've learned so far.

name = "   "
while (name != ""):
       name = raw_input("Enter in the name: ")
       if (name == ""):
             continue
       elif (name == "quit"):
             break
       phone_number = raw_input("Enter in the phone number: ")
       address_line1 = raw_input("Enter address line one: ")
       if (address_line1 == ""):
             continue
       address_line2 = raw_input("Enter address line two: ")
       address_line3 = raw_input("Enter address line three: ")
       #do something useful with the addresses
else:
       print("send the email to Rick")
       #emailAddresses("rick_m_hightower@emailcompany.com")

Organization

The first ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with O’Reilly online learning.

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