Python Exercises – Groups of People

This exercise starts very simple, but gets interesting in the extensions.  If you take this far enough, you could build a social network.  This exercise is meant to be done several times, as you learn more about programming.  You will find that some of these seem impossible when you are brand new to programming, but they will become possible as you learn to manage information effectively.

  • Think of a group of people you know.  It could be the class you are in, a group of friends, or you can make up a group of people.
  • Print a message that says hello to each person in your group.
  • Extensions:
    • Store the people’s names in a list, and iterate through the list to say hello to each person.
    • Include both people’s first names and last names.
      • Print a message to each person, in order by first name.
      • Print a message to each person, in order by last name.
    • Find out each person’s birthdate.  Print a listing of each person’s name and birthdate.
      • Print your listing in order from youngest to oldest, and then from oldest to youngest.
      • When you print your listing, if a person’s birthday is coming up in the next 30 days, display a special message for that person.
    • Store people’s information in a dictionary, if you have not done so already.

About ehmatthes

Teacher, hacker, new dad, outdoor guy
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s