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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.