I don’t really understand the solution. The first section of code is the answer provided.
def x_length_words(sentence, x):
words = sentence.split(" ")
for word in words:
if len(word) < x:
And this is my solution:
for i in new:
print(x_length_words(“i like apples”, 2))
should print False
print(x_length_words(“he likes apples”, 2))
should print True
My code, returned True and True. But it should return False and True.
Since the length of “i” is less than 2, it will return False, but it returned True.
Any help is appreciated. Thanks.