How do i assign an owner to his/her pets? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i assign an owner to his/her pets?

Both lists are lists of objects, owner list with attributes name, lastname, and petlist with attributes typeofpet,name, gender and age. Parent=[[”Sara”, ”Johnson”],[”Hector”, ”Rodriguez”]] Pets=[[”cat”, ”catname”, ”male”, 2],[”bird”, ”birdname”, ”female”, 3]] How do i for example give sara both of the pets?

25th Mar 2022, 8:58 PM
Lenoname
1 Answer
+ 1
Use a dictionary.
25th Mar 2022, 9:29 PM
Simon Sauter
Simon Sauter - avatar