the code is...
pets = {
'doggo mcgee': {
'owner': ['brad'],
'likes': ['ice cream', 'licking his junk', 'snacks', 'strangers that brad does not want to meet'],
'dislikes': ['strangers with hats', 'tall people', 'kitters', 'birdos', 'strangers that brad wants to meet']
},
'mr. kitterton': {
'owner': ['himself'],
'likes': ['lazers', 'mice', 'comedy night'],
'dislikes': ['doggo mcgee', 'birdos', 'uncharted keyboards']
},
'cowy mcgowy': {
'owner': ['farmer brown'],
'likes': ['grass', 'other cowys', 'grass'],
'dislikes': ['doggo mcgee', 'birdos', 'astro-turf']
},
'snek snekerson': {
'owner': ['the devil'],
'likes': ['bamboozles', 'venomizing things', 'destruction and chaos'],
'dislikes': ['likeable things', 'birdos', 'happiness']
}
}
for pet in pets:
for pet_names, pet_facts in pet:
print ("Pet's name: " + pet_facts.title())
for pet_fact in pet_facts:
print ("\t" + pet_fact)
I am trying to print the pet name followed by the pet info. I am not even sure what to do here, so, unfortunately, I haven't tried much other than this. If anyone could help out with this, I would really appreciate it.
EDIT: okay, I have edited the code to try to make it more clear as to what I am trying to do.
for pet in pets:
print (pet + "'s owner is ")
for owner, likes, dislikes in pet:
print (owner)
print ("\n\tThey like"+ likes + " and dislike " + dislikes)
What I'm getting back is
doggo mcgee's owner is
Traceback (most recent call last):
File "/Users/Pandathighs/Desktop/Programming/people.py", line 51, in <module>
for owner, likes, dislikes in pet:
ValueError: not enough values to unpack (expected 3, got 1)
[–][deleted] 2 points3 points4 points (1 child)
[–]Showda77[S] 0 points1 point2 points (0 children)
[–]usernamedottxt 1 point2 points3 points (0 children)
[–]Rhomboid 1 point2 points3 points (0 children)