Friday, October 10, 2014

Day 134

Python at CodeCademy. Worked on Python tutorial 2 of 13, A Day at the Supermarket: This is KEY! Worked on using a for loop on a dictionary to loop through its keys.

Code used:
webster = {
"Aardvark" : "A star of a popular children's cartoon show.",
    "Baa" : "The sound a goat makes.",
    "Carpet": "Goes on the floor.",
    "Dab": "A small amount."
}
for key in webster:
    print webster[key]


Interaction for this code:
A star of a popular children's cartoon show.
The sound a goat makes.
Goes on the floor.
A small amount.

No comments:

Post a Comment