Question: Code in python please and thank you! Write a function animals ) that takes two arguments, in this order . C: a list of creatures,


Code in python please and thank you!
Write a function animals ) that takes two arguments, in this order . C: a list of creatures, some of which are animals A: a list of valid animal names Each string in C is a list of creatures, some of which are animals. The strings in A are guaranteed to be unique. The function inspects C and then counts how many of the creatures in that list are valid animal names (i.e., using A). The function always returns an integer. Either or both of A and C could be empty, in which case the function returns 0. You may assume that every string in each list is a single word OR.REDOTululln:: leaesireill ess se C= [,quaggoth, , , chipmunk, , ,bugbear, , ,dingo ,, ,we rewolf', ,salamander', A-'hedgehog', jackal', 'hyena', 'steer, 'chipmunk', 'dingo','leopard', jackal','hyena', 'meazel', 'elf, 'hobgoblin' salamander'] Return value: 5 Example #2: Empty list of animals C= ['hobgoblin, , ,gremlin,, ,og re , , ,ettin,, ,bugbear, , , cyclopskin', flind', 'troll'] Return value: 0 Example #3: Empty list of creatures C= [] A'panther,xdromedary' 'walrus' Return value: 0 Example #4: All creatures are animals C 'coati', 'puppy', ' snake', 'salamander' ] A-'wolverine', 'puppy', 'ibex', 'dingo', 'salamander', 'coati', 'opossum 'snake' ] Return value: 4 Example #5: No creatures are animals C = [ , dragon, , , fairy, , , orc, , , troll, , , ogrillon, ] A-'steer', 'panda', 'gnu', 'walrus', 'eagle,'shrew', 'ewe' Return value: 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
