Skip to content

Instantly share code, notes, and snippets.

@dalequark
Created October 22, 2020 16:44
Show Gist options
  • Save dalequark/c369014eb3b0a5ce0c4d77eb3ab4af07 to your computer and use it in GitHub Desktop.
Save dalequark/c369014eb3b0a5ce0c4d77eb3ab4af07 to your computer and use it in GitHub Desktop.
def canAddItem(existingArray, newType):
bottoms = {"pants", "skirt", "shorts", "dress"}
newType = newType.lower()
if newType in existingArray:
return False
if newType == "shoe":
return True
if newType in bottoms and len(bottoms.intersection(existingArray)):
return False
if newType == "top" and "dress" in existingArray:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment