Created
February 12, 2021 15:34
-
-
Save nicoandmee/d71ce23f9fca0dd17f46794234d177d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cisc108 import assert_equal | |
def all_cats(animals): | |
if not animals: | |
return True | |
animalsList = animals.split(",") | |
# neither of the below are accepted, the 2nd seems like it definitely should be | |
# return False if False in ["cat" in x for x in animalsList] else True | |
# return all("cat" in x for x in animalsList) | |
assert_equal(all_cats("gerbil,catfish,dog,cat"), False) | |
assert_equal(all_cats("cat,catfish"), True) | |
assert_equal(all_cats(""), True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment