Write a function isAllLettersUsed(word, required) that takes in a word as the first argument and returns True if the word contains all the letters found in the second argument.
Examples
>>> isAllLettersUsed('apple', 'apple')
True
>>> isAllLettersUsed('apple', 'google')
False
>>> isAllLettersUsed('learning python', 'google')
True
>>> isAllLettersUsed('learning python', 'apple')
True
What i'm Doing is
def isAllLettersUsed(word, required):
if all(required in word for required in word):
return True
else:
return False
And Result returning is
True
True
True
True
Where as it should return as
True
False
True
True
i don't understand what should i do at this point i have tried many things but failed. any suggestion??
for required in wordmeans "for each letter inword, assign it to a variable namedrequired(and incidentally shadow the old one)." You probably want to usefor ch in requiredor something similar.