Skip to content

Commit

Permalink
Mutations the-vampiire#3 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduccao committed Oct 27, 2019
1 parent 6eb5472 commit 69bd783
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/intermediate/mutations_minhduccao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Assumes list only contains 2 string elements
def mutations(sList):
mainWord = sList[0].lower() # Set words to lowercase to ignore lettercase
checkWord = sList[1].lower()
mainLetters = set(mainWord) # Used sets to separate words into letters
checkLetters = set(checkWord) # because repetition isn't checked

for x in checkLetters: # Checks through each letter to see if it's in the main word
if x not in mainLetters:
return False # Returns False if letter isn't in, no need to continue for loop if not found
return True

0 comments on commit 69bd783

Please sign in to comment.