cat_dog¶
Requirements:
substrings and slicing
if, elif, else
loop through a string (while)
loop with an accumulator variable
Output True
if the substrings "cat"
and "dog"
appear the same number of times in a string input by the user. Otherwise, output False
.
This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.