0
name of list's element
I need to use name of list's element in my code. pets = [panky, sunny, frosty] I need to use 'panky' in print(). Not key or values.
9 Respostas
0
because it's not string it's dictionary
0
panky = {
'pet': 'dog',
'breed': 'poodle',
'owner': 'john'
}
...
it's a nested list
and I need to get after (cycle for) print():
Panky is a John's poodle.
0
it' the assignment in my book. can not this be done?
0
panky = {
'pet': 'dog',
'breed': 'poodle',
'owner': 'john'
}
sunny = {
'pet': 'cat',
'breed': 'sphynx',
'owner': 'stive'
}
sunny = {
'pet': 'parrot',
'breed': 'budgie',
'owner': 'lusy'
}
pets = [panky, sunny, frosty]
for pet in pats:
print(?????? + 'it's '+ pet['owner'].title() + '\'s ' + pet['pet'] + '.')
0
you don't understand my question. I need to use NAME pets[0] pets[1] pets[2]