मैं अनिवार्य रूप से एक काउंटर बना रहा हूं और यह किसी सूची में किसी नाम के प्रकट होने की संख्या की गणना करता है। मैं एक फ़ंक्शन का उपयोग करने की कोशिश कर रहा हूं ताकि मैं इसे सभी नामों के लिए आसानी से कर सकूं। यह ठीक काम करता है जब मैं कोड को फ़ंक्शन नहीं बनाता लेकिन जैसे ही मैं करता हूं यह अब y का मान नहीं देता है।

#
animal_types=['Elephant', 'Rhinoceros', 'Lion','Water Buffalo','Leopard','Giraffe','Giraffe','Ghu','Thompson Gazelle','Dik Dik','Zebra','Baboon','Hyena','Hippopotamus','Crocodile','Ostrich','Wild Dog','WartHog','Vulture']

short_animal_list = ['Baboon', 'Gnu', 'WartHog', 'Gnu', 'Vulture', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'WartHog', 'Zebra', 'Zebra', 'Leopard', 'Gnu', 'Gnu', 'Elephant', 'Gnu']

medium_animal_list = ['Thompson Gazelle', 'Gnu', 'Lion', 'Vulture', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Hyena', 'Thompson Gazelle', 'Thompson Gazelle', 'Hyena', 'Gnu', 'Vulture', 'Vulture', 'Leopard', 'Zebra', 'Zebra', 'Crocodile', 'Zebra', 'Gnu', 'Gnu', 'Vulture', 'Hippopotamus', 'Gnu', 'Gnu', 'Zebra', 'Baboon', 'Vulture', 'Baboon', 'Baboon', 'WartHog', 'Gnu', 'Baboon', 'Zebra', 'Dik Dik', 'Rhinoceros', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Hippopotamus', 'Zebra', 'Giraffe', 'Zebra', 'Hyena', 'Zebra', 'Crocodile', 'WartHog', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Zebra', 'Zebra', 'Gnu', 'Hippopotamus', 'Gnu', 'Gnu', 'Elephant', 'Baboon', 'Gnu', 'Gnu', 'Gnu', 'Crocodile', 'Giraffe', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Dik Dik', 'Baboon', 'Gnu', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Leopard', 'Vulture', 'Gnu', 'Dik Dik', 'Thompson Gazelle', 'Elephant', 'Gnu', 'Vulture', 'Crocodile', 'Zebra', 'Gnu', 'Rhinoceros', 'Zebra', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Dik Dik', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Elephant', 'Hippopotamus', 'Baboon', 'Zebra', 'WartHog', 'Gnu', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Elephant', 'Thompson Gazelle', 'Vulture', 'Zebra', 'Hyena', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Baboon', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Hippopotamus', 'Crocodile', 'Thompson Gazelle', 'Gnu', 'Dik Dik', 'Vulture', 'Gnu', 'Zebra', 'Zebra', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Dik Dik', 'Zebra', 'Baboon', 'Gnu', 'Zebra', 'Zebra', 'Vulture', 'Zebra', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Giraffe', 'Zebra', 'Zebra', 'Hyena', 'Crocodile', 'WartHog', 'Zebra', 'Zebra', 'Giraffe', 'Hyena', 'Giraffe', 'Vulture', 'Zebra', 'Zebra', 'Vulture', 'Baboon', 'WartHog', 'Zebra', 'Gnu', 'Gnu', 'Hyena']

long_animal_list = ['WartHog', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Lion', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Thompson Gazelle', 'Lion', 'Gnu', 'Vulture', 'Crocodile', 'Zebra', 'Gnu', 'Lion', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Crocodile', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Hyena', 'Zebra', 'Thompson Gazelle', 'Dik Dik', 'Baboon', 'Thompson Gazelle', 'Vulture', 'Elephant', 'Vulture', 'Vulture', 'WartHog', 'Zebra', 'Giraffe', 'Gnu', 'Hyena', 'Crocodile', 'Gnu', 'Gnu', 'Hippopotamus', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Dik Dik', 'Zebra', 'Zebra', 'WartHog', 'Gnu', 'Baboon', 'Gnu', 'Hyena', 'Vulture', 'Gnu', 'Zebra', 'WartHog', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Hyena', 'WartHog', 'Elephant', 'Giraffe', 'Elephant', 'Thompson Gazelle', 'Vulture', 'Zebra', 'WartHog', 'Zebra', 'Vulture', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Elephant', 'WartHog', 'Vulture', 'WartHog', 'Thompson Gazelle', 'Gnu', 'Dik Dik', 'Gnu', 'Zebra', 'Crocodile', 'Leopard', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Zebra', 'Gnu', 'Water Buffalo', 'Zebra', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Baboon', 'Thompson Gazelle', 'Wild Dog', 'Zebra', 'Thompson Gazelle', 'Vulture', 'Thompson Gazelle', 'Baboon', 'Baboon', 'Zebra', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Crocodile', 'WartHog', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Vulture', 'Baboon', 'Zebra', 'Hippopotamus', 'Water Buffalo', 'Dik Dik', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Elephant', 'Gnu', 'Hyena', 'Zebra', 'Water Buffalo', 'Gnu', 'Baboon', 'Gnu', 'Dik Dik', 'Gnu', 'Zebra', 'Rhinoceros', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Water Buffalo', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Hyena', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Crocodile', 'WartHog', 'Gnu', 'Elephant', 'Hippopotamus', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Baboon', 'Gnu', 'Gnu', 'Dik Dik', 'Gnu', 'Hippopotamus', 'Gnu', 'Gnu', 'Gnu', 'Wild Dog', 'Zebra', 'Gnu', 'Baboon', 'Gnu', 'Gnu', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Lion', 'Hyena', 'Crocodile', 'Hyena', 'Vulture', 'Hyena', 'Dik Dik', 'Gnu', 'Gnu', 'Thompson Gazelle', 'WartHog', 'Thompson Gazelle', 'Hippopotamus', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Lion', 'Gnu', 'WartHog', 'Dik Dik', 'Zebra', 'Crocodile', 'Zebra', 'Thompson Gazelle', 'Vulture', 'Vulture', 'Hippopotamus', 'Wild Dog', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Giraffe', 'Zebra', 'Crocodile', 'Hyena', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Giraffe', 'Cheetah', 'Zebra', 'Hippopotamus', 'Dik Dik', 'Gnu', 'Gnu', 'Hippopotamus', 'Thompson Gazelle', 'Dik Dik', 'Zebra', 'Giraffe', 'Gnu', 'Thompson Gazelle', 'Crocodile', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Leopard', 'Giraffe', 'Thompson Gazelle', 'Thompson Gazelle', 'Vulture', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Cheetah', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Hippopotamus', 'Hyena', 'Baboon', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Vulture', 'Zebra', 'Gnu', 'Elephant', 'Thompson Gazelle', 'Crocodile', 'Gnu', 'Gnu', 'Gnu', 'Baboon', 'Crocodile', 'Giraffe', 'Gnu', 'Water Buffalo', 'Zebra', 'Gnu', 'Baboon', 'Zebra', 'Dik Dik', 'Zebra', 'Zebra', 'Hyena', 'WartHog', 'Gnu', 'Zebra', 'Hippopotamus', 'Vulture', 'Thompson Gazelle', 'Vulture', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Crocodile', 'Dik Dik', 'Gnu', 'Crocodile', 'Gnu', 'WartHog', 'Baboon', 'Hyena', 'Vulture', 'Thompson Gazelle', 'Thompson Gazelle', 'Thompson Gazelle', 'WartHog', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'WartHog', 'Dik Dik', 'Thompson Gazelle', 'Hyena', 'Hyena', 'Baboon', 'Zebra', 'Lion', 'Thompson Gazelle', 'Leopard', 'Lion', 'Vulture', 'Elephant', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Elephant', 'Leopard', 'Elephant', 'Thompson Gazelle', 'Hyena', 'Giraffe', 'Thompson Gazelle', 'Thompson Gazelle', 'Vulture', 'Zebra', 'Gnu', 'Gnu', 'Hippopotamus', 'Gnu', 'Zebra', 'Elephant', 'Gnu', 'Thompson Gazelle', 'Lion', 'Zebra', 'Gnu', 'Gnu', 'Zebra', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Baboon', 'Crocodile', 'Giraffe', 'Thompson Gazelle', 'Hyena', 'Vulture', 'Gnu', 'Wild Dog', 'Baboon', 'Giraffe', 'Vulture', 'Dik Dik', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Gnu', 'Zebra', 'Crocodile', 'Zebra', 'Gnu', 'Dik Dik', 'Gnu', 'Gnu', 'Gnu', 'Cheetah', 'Gnu', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Lion', 'Lion', 'Zebra', 'Gnu', 'Gnu', 'Baboon', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Gnu', 'Zebra', 'Hippopotamus', 'Gnu', 'Vulture', 'Gnu', 'Gnu', 'Zebra', 'Zebra', 'Crocodile', 'Baboon', 'Gnu', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Giraffe', 'Zebra', 'WartHog', 'Gnu', 'Gnu', 'Gnu', 'Dik Dik', 'Dik Dik', 'Zebra', 'Gnu', 'Giraffe', 'Cheetah', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Baboon', 'Zebra', 'Gnu', 'Crocodile', 'Gnu', 'Baboon', 'Ostrich', 'Thompson Gazelle', 'Zebra', 'Hippopotamus', 'Baboon', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Vulture', 'Zebra', 'Zebra', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Giraffe', 'Gnu', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Hyena', 'Zebra', 'Vulture', 'Hyena', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Vulture', 'Gnu', 'Dik Dik', 'Zebra', 'WartHog', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Leopard', 'Zebra', 'Vulture', 'Vulture', 'Hippopotamus', 'Zebra', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Vulture', 'Zebra', 'Vulture', 'Wild Dog', 'Hyena', 'Lion', 'Crocodile', 'Gnu', 'Elephant', 'Zebra', 'WartHog', 'Vulture', 'Thompson Gazelle', 'Thompson Gazelle', 'Zebra', 'WartHog', 'Thompson Gazelle', 'Lion', 'Zebra', 'Zebra', 'Gnu', 'Rhinoceros', 'Zebra', 'Giraffe', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Baboon', 'Gnu', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Vulture', 'Zebra', 'Zebra', 'Zebra', 'Elephant', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Gnu', 'Wild Dog', 'WartHog', 'Gnu', 'Crocodile', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Zebra', 'Gnu', 'Crocodile', 'Giraffe', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Hyena', 'Gnu', 'Gnu', 'Lion', 'Hippopotamus', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Vulture', 'Zebra', 'Zebra', 'Baboon', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Hyena', 'Gnu', 'Zebra', 'Zebra', 'Giraffe', 'Baboon', 'Gnu', 'Zebra', 'Gnu', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Rhinoceros', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Elephant', 'Thompson Gazelle', 'Ostrich', 'Zebra', 'Zebra', 'Water Buffalo', 'Lion', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Baboon', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Vulture', 'Giraffe', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Rhinoceros', 'Gnu', 'Vulture', 'Gnu', 'Zebra', 'Gnu', 'Hyena', 'Zebra', 'Gnu', 'Vulture', 'Crocodile', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Zebra', 'Hyena', 'Thompson Gazelle', 'Giraffe', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'WartHog', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Baboon', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Hippopotamus', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Giraffe', 'WartHog', 'Zebra', 'Hyena', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Crocodile', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Vulture', 'Gnu', 'Gnu', 'Zebra', 'Hyena', 'WartHog', 'Vulture', 'Elephant', 'Giraffe', 'WartHog', 'Zebra', 'Baboon', 'Zebra', 'Water Buffalo', 'Zebra', 'Hyena', 'Hyena', 'Zebra', 'Crocodile', 'Baboon', 'Thompson Gazelle', 'Zebra', 'Hyena', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Hippopotamus', 'Dik Dik', 'Thompson Gazelle', 'Hippopotamus', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Vulture', 'Dik Dik', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Vulture', 'Elephant', 'Crocodile', 'Gnu', 'Gnu', 'Vulture', 'Zebra', 'Gnu', 'Gnu', 'Baboon', 'Zebra', 'Zebra', 'Hippopotamus', 'Hippopotamus', 'Gnu', 'Gnu', 'Zebra', 'Baboon', 'Gnu', 'Gnu', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Giraffe', 'Zebra', 'Vulture', 'Hippopotamus', 'Zebra', 'Baboon', 'Thompson Gazelle', 'Zebra', 'Vulture', 'Vulture', 'Hippopotamus', 'Thompson Gazelle', 'Crocodile', 'Lion', 'Zebra', 'Thompson Gazelle', 'Baboon', 'Dik Dik', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Baboon', 'Gnu', 'Thompson Gazelle', 'Baboon', 'Baboon', 'Hippopotamus', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Hyena', 'Crocodile', 'Zebra', 'Gnu', 'Baboon', 'Gnu', 'Zebra', 'Giraffe', 'Thompson Gazelle', 'Vulture', 'Thompson Gazelle', 'Crocodile', 'Dik Dik', 'Giraffe', 'Elephant', 'Baboon', 'Thompson Gazelle', 'Giraffe', 'Zebra', 'Zebra', 'Vulture', 'Hyena', 'Vulture', 'WartHog', 'Gnu', 'Zebra', 'Gnu', 'WartHog', 'Elephant', 'Thompson Gazelle', 'Zebra', 'Dik Dik', 'Elephant', 'Gnu', 'Ostrich', 'Dik Dik', 'Gnu', 'Hyena', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Wild Dog', 'Crocodile', 'Giraffe', 'Wild Dog', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Hyena', 'Thompson Gazelle', 'Thompson Gazelle', 'Crocodile', 'Thompson Gazelle', 'Elephant', 'Thompson Gazelle', 'Leopard', 'Zebra', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Crocodile', 'Gnu', 'Giraffe', 'Gnu', 'Zebra', 'Thompson Gazelle', 'WartHog', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Hippopotamus', 'Dik Dik', 'Zebra', 'Gnu', 'Hippopotamus', 'Zebra', 'Baboon', 'Gnu', 'Gnu', 'Zebra', 'WartHog', 'Gnu', 'Giraffe', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Lion', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Zebra', 'Vulture', 'Zebra', 'Giraffe', 'Thompson Gazelle', 'Gnu', 'Vulture', 'Crocodile', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Hyena', 'Zebra', 'Baboon', 'WartHog', 'Gnu', 'Gnu', 'Giraffe', 'Crocodile', 'Hippopotamus', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Baboon', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Hyena', 'Dik Dik', 'Zebra', 'Elephant', 'Giraffe', 'Gnu', 'Zebra', 'Gnu', 'Hyena', 'Baboon', 'Baboon', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Elephant', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Thompson Gazelle', 'Giraffe', 'Baboon', 'Thompson Gazelle', 'Leopard', 'Gnu', 'Baboon', 'Giraffe', 'Gnu', 'Elephant', 'Thompson Gazelle', 'Zebra', 'Baboon', 'Vulture', 'Lion', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Vulture', 'Gnu', 'Gnu', 'Zebra', 'Giraffe', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Zebra', 'Hyena', 'Hippopotamus', 'Rhinoceros', 'Thompson Gazelle', 'Thompson Gazelle', 'Crocodile', 'Hippopotamus', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Elephant', 'Zebra', 'Crocodile', 'Vulture', 'Zebra', 'WartHog', 'Zebra', 'Zebra', 'Crocodile', 'Gnu', 'Hippopotamus', 'Hippopotamus', 'Baboon', 'Hyena', 'Zebra', 'Vulture', 'Zebra', 'Zebra', 'Zebra', 'Baboon', 'Thompson Gazelle', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Hyena', 'Dik Dik', 'Thompson Gazelle', 'Gnu', 'Giraffe', 'Vulture', 'Gnu', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Elephant', 'Crocodile', 'Rhinoceros', 'Dik Dik', 'Giraffe', 'Zebra', 'Lion', 'Zebra', 'Hippopotamus', 'Thompson Gazelle', 'Cheetah', 'Thompson Gazelle', 'Elephant', 'Baboon', 'Vulture', 'Dik Dik', 'Thompson Gazelle', 'Vulture', 'Giraffe', 'Zebra', 'Wild Dog', 'Thompson Gazelle', 'WartHog', 'Thompson Gazelle', 'Gnu', 'Crocodile', 'Vulture', 'Cheetah', 'WartHog', 'Zebra', 'Lion', 'Zebra', 'Gnu', 'Gnu', 'Water Buffalo', 'Elephant', 'Giraffe', 'Vulture', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Zebra', 'Hippopotamus', 'Baboon', 'Thompson Gazelle', 'Hyena', 'Crocodile', 'Gnu', 'Zebra', 'Wild Dog', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Vulture', 'Giraffe', 'Gnu', 'Crocodile', 'Zebra', 'Zebra', 'Gnu', 'Hyena', 'WartHog', 'Zebra', 'Zebra', 'Hippopotamus', 'Zebra', 'Thompson Gazelle', 'Ostrich', 'Crocodile', 'Crocodile', 'Lion', 'Gnu', 'Dik Dik', 'Rhinoceros', 'Crocodile', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Crocodile', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Crocodile', 'Gnu', 'Zebra', 'Baboon', 'Hyena', 'Leopard', 'Gnu', 'Vulture', 'Water Buffalo', 'Zebra', 'Leopard', 'Zebra', 'Gnu', 'Gnu', 'Zebra', 'Hippopotamus', 'Gnu', 'Vulture', 'Baboon', 'Dik Dik', 'Elephant', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Hyena', 'Thompson Gazelle', 'WartHog', 'Zebra', 'Giraffe', 'Gnu', 'Thompson Gazelle', 'Hippopotamus', 'Elephant', 'Zebra', 'Dik Dik', 'Crocodile', 'Gnu', 'Gnu', 'Cheetah', 'Gnu', 'Elephant', 'Gnu', 'Gnu', 'Gnu', 'Leopard', 'Hippopotamus', 'Baboon', 'Zebra', 'WartHog', 'WartHog', 'Gnu', 'Gnu', 'Zebra', 'Dik Dik', 'Crocodile', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Water Buffalo', 'Hippopotamus', 'Zebra', 'WartHog', 'Crocodile', 'Gnu', 'Zebra', 'Crocodile', 'Gnu', 'WartHog', 'Zebra', 'WartHog', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Hyena', 'Gnu', 'Gnu', 'Dik Dik', 'Baboon', 'WartHog', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Gnu', 'WartHog', 'Gnu', 'Zebra', 'Baboon', 'Dik Dik', 'Gnu', 'Zebra', 'Crocodile', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Crocodile', 'Vulture', 'Elephant', 'Baboon', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Baboon', 'Hippopotamus', 'Hyena', 'Zebra', 'Elephant', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Thompson Gazelle', 'WartHog', 'Gnu', 'Gnu', 'Elephant', 'Gnu', 'WartHog', 'WartHog', 'Gnu', 'Baboon', 'Dik Dik', 'Hippopotamus', 'Crocodile', 'Hyena', 'WartHog', 'Elephant', 'Vulture', 'Gnu', 'Baboon', 'Zebra', 'Thompson Gazelle', 'Hippopotamus', 'Crocodile', 'Zebra', 'Wild Dog', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Vulture', 'Thompson Gazelle', 'Gnu', 'Crocodile', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Giraffe', 'Thompson Gazelle', 'Hyena', 'Zebra', 'Baboon', 'Lion', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Gnu', 'WartHog', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Hippopotamus', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Lion', 'Gnu', 'Baboon', 'Gnu', 'Dik Dik', 'Gnu', 'Giraffe', 'Thompson Gazelle', 'Dik Dik', 'Zebra', 'Gnu', 'Gnu', 'Zebra', 'Gnu', 'WartHog', 'Leopard', 'Zebra', 'Hyena', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Hyena', 'Thompson Gazelle', 'Vulture', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Elephant', 'Baboon', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'Gnu', 'Baboon', 'Elephant', 'Zebra', 'Baboon', 'Zebra', 'Lion', 'Baboon', 'Zebra', 'Zebra', 'Zebra', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Elephant', 'Zebra', 'Gnu', 'Zebra', 'Vulture', 'Cheetah', 'Water Buffalo', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Gnu', 'WartHog', 'Zebra', 'Dik Dik', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Giraffe', 'Hyena', 'Gnu', 'Vulture', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Water Buffalo', 'Leopard', 'Elephant', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Hyena', 'Leopard', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Baboon', 'Giraffe', 'Gnu', 'Vulture', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'WartHog', 'Leopard', 'Zebra', 'Thompson Gazelle', 'Vulture', 'Baboon', 'Gnu', 'Baboon', 'Zebra', 'Gnu', 'Ostrich', 'Ostrich', 'Zebra', 'Hippopotamus', 'Vulture', 'Crocodile', 'Thompson Gazelle', 'Thompson Gazelle', 'Dik Dik', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Crocodile', 'Gnu', 'Baboon', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Crocodile', 'Gnu', 'Dik Dik', 'Rhinoceros', 'Vulture', 'Gnu', 'Hyena', 'Gnu', 'Lion', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Baboon', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Gnu', 'Gnu', 'Zebra', 'Water Buffalo', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Water Buffalo', 'Gnu', 'Giraffe', 'Thompson Gazelle', 'Crocodile', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Elephant', 'Gnu', 'WartHog', 'Gnu', 'Gnu', 'Lion', 'Dik Dik', 'Gnu', 'Gnu', 'Zebra', 'Vulture', 'Gnu', 'WartHog', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Vulture', 'Zebra', 'Gnu', 'WartHog', 'WartHog', 'Gnu', 'Hyena', 'Vulture', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Zebra', 'Zebra', 'WartHog', 'Vulture', 'Zebra', 'Crocodile', 'Elephant', 'Thompson Gazelle', 'Lion', 'Thompson Gazelle', 'Hyena', 'Gnu', 'Thompson Gazelle', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Baboon', 'Zebra', 'Vulture', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Vulture', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Rhinoceros', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Gnu', 'Gnu', 'Vulture', 'Elephant', 'Baboon', 'Baboon', 'Vulture', 'Zebra', 'Zebra', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Vulture', 'Wild Dog', 'Zebra', 'WartHog', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Gnu', 'Zebra', 'Gnu', 'Vulture', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Baboon', 'Giraffe', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Lion', 'Lion', 'Gnu', 'Lion', 'Zebra', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Giraffe', 'Gnu', 'Thompson Gazelle', 'Zebra', 'Gnu', 'Hippopotamus', 'Water Buffalo', 'Gnu', 'Giraffe', 'Gnu', 'Vulture', 'Gnu', 'Baboon', 'Gnu', 'Gnu', 'Dik Dik', 'Zebra', 'Zebra', 'Giraffe', 'Gnu', 'Zebra', 'Gnu', 'Baboon', 'Zebra', 'Elephant', 'Zebra', 'Gnu', 'Hyena', 'Zebra', 'Crocodile', 'Gnu', 'Thompson Gazelle', 'Giraffe', 'Wild Dog', 'Gnu', 'Thompson Gazelle', 'Thompson Gazelle', 'Crocodile', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Giraffe', 'Baboon', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Thompson Gazelle', 'WartHog', 'Thompson Gazelle', 'Thompson Gazelle', 'Hyena', 'Hyena', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'WartHog', 'Zebra', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Hippopotamus', 'Elephant', 'Gnu', 'Baboon', 'Vulture', 'Elephant', 'Baboon', 'Hyena', 'Crocodile', 'Gnu', 'Elephant', 'Crocodile', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Gnu', 'Zebra', 'Hippopotamus', 'Hyena', 'Hippopotamus', 'Thompson Gazelle', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Baboon', 'Zebra', 'Gnu', 'Hyena', 'Gnu', 'Hippopotamus', 'Gnu', 'WartHog', 'Elephant', 'Vulture', 'Thompson Gazelle', 'Zebra', 'Thompson Gazelle', 'Water Buffalo', 'Zebra', 'Giraffe', 'Baboon', 'Water Buffalo', 'WartHog', 'Zebra', 'Gnu', 'Zebra', 'Zebra', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Zebra', 'Zebra', 'Leopard', 'Vulture', 'Gnu', 'Thompson Gazelle', 'Rhinoceros', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Lion', 'Gnu', 'Gnu', 'Crocodile', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Gnu', 'Gnu', 'Baboon', 'Thompson Gazelle', 'Gnu', 'Vulture', 'Elephant', 'Thompson Gazelle', 'Gnu', 'Vulture', 'Thompson Gazelle', 'Zebra', 'WartHog', 'Zebra', 'Thompson Gazelle', 'Giraffe', 'Giraffe', 'WartHog', 'Gnu', 'Gnu', 'Thompson Gazelle', 'Gnu', 'Gnu', 'Zebra', 'Thompson Gazelle']

#print(short_animal_list)
#print(medium_animal_list)
#print(long_animal_list)

# 1) Pick an animal from the 'animal_types' list and count 
# how many there are in the 'short_animal_list'.  Then count 
# from the 'medium' list and the 'long' list

# 2) Look at the 'animal_types' list and count the number of 
# each animal from the short, medium, and ling list

elephant_count = 0
lion_count = 0
gnu_count = 0
#-------------------------------
# ---- Enter Your Code Here ----
def Counter(x,y) :
  for i in short_animal_list :
    if i == x :
      y = y + 1
      print(i)
      print('found',i)
      return (y)

Counter('Gnu',gnu_count)





#-------------------------------
# Output
print('Animal Count')
print('Elephants = ',elephant_count)
print('Lions = ',lion_count)
print("Gnu = ",gnu_count)
0
FroyFries 18 अप्रैल 2021, 05:14

1 उत्तर

किसी फ़ंक्शन के अंदर असाइनमेंट वैश्विक चर को संशोधित नहीं करता है। किसी फ़ंक्शन के अंदर से वैश्विक चर को संशोधित करने के लिए, नीचे दिखाए गए अनुसार वैश्विक कीवर्ड का उपयोग करें।

def Counter(x,y) :
  for i in short_animal_list :
    if i == x :
      y = y + 1
      print(i)
      print('found',i)
      print(y)
      global gnu_count
      gnu_count = y
      return (y)
0
dossani 18 अप्रैल 2021, 02:39