O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

6-8. Pets:

From

Cover of Python Crash Course

Note

pets = [{'name': 'bush', 'kind': 'cat', 'owner': 'jacey'}, {'name': 'cathy', 'kind': 'cat', 'owner': 'Blare'}, {'name': 'tiny', 'kind': 'pig', 'owner': 'Twist'}]
for pet in pets:
print("\npet name: " + pet['name'].title())
print("kind: " + pet['kind'].title())
print('owner: ' + pet['owner'].title())