Question: Return True if the string cat and dog appear the same number of times in the given string. You may not use any built in

Return True if the string "cat" and "dog" appear the same number of times in the given string. You may not use any built in Python string functions, except for len(). Complete the exercise using a For Loop and a While Loop.

Example: cat_dog('catdog') True

cat_dog('catcat') False

def cat_dog_while(str):

#missing code

def cat_dog_for(str):

missing code

Help me with my python! Thank you so much :)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!