Skip to content

Instantly share code, notes, and snippets.

@nicoandmee
Created February 12, 2021 15:34
Show Gist options
  • Save nicoandmee/d71ce23f9fca0dd17f46794234d177d4 to your computer and use it in GitHub Desktop.
Save nicoandmee/d71ce23f9fca0dd17f46794234d177d4 to your computer and use it in GitHub Desktop.
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