Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2.  
  3. jessica = {'first_name' : 'Jessica'
  4. , 'last_name' : 'Alvarez'
  5. , 'location' : 'princeton'
  6. }
  7.  
  8. timmy = {'first_name' : 'Timmy'
  9. , 'last_name' : 'Turner'
  10. , 'location' : 'Mexico'
  11. }
  12.  
  13. people = [jessica, timmy]
  14.  
  15. for person in people:
  16. print("Full name: " + person['first_name'].title() + " " + person['last_name'].title())
  17. print("Location: " + person['location'].title() + "\n")
  18.  
  19. apple = {'kind' : 'cat'
  20. , 'owner' : 'jessica'
  21. }
  22.  
  23. whitey = {'kind' : 'dog'
  24. , 'owner' : 'timmy'
  25. }
  26.  
  27. pets = [apple, whitey]
  28.  
  29. for pet in pets:
  30. print(pet['owner'].title() + "'s pet is a " + pet['kind'].title())
  31.  
  32. favplaces = {'timmy' : ['rome']
  33. , 'jessica' : ['madrid', 'paris']
  34. , 'jason' : ['pennsylvania', 'london', 'ikkebukuro']
  35. }
  36.  
  37. print('')
  38. for name, place in favplaces.items():
  39. if len(place) == 1:
  40. print(name.title() + "'s favorite place is " + place[0].title())
  41. elif len(place) == 2:
  42. print(name.title() + "'s favorite places are "
  43. + place[0].title() + " and "
  44. + place[1].title()
  45. )
  46. else:
  47. print(name.title() + "'s favorite places are "
  48. + place[0].title() + ", "
  49. + place[1].title() + ", and "
  50. + place[2].title()
  51. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement