forked from the-vampiire/hacktoberithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6eb5472
commit 69bd783
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |