I have the following mini program:
- Code: Select all
sentence = "Hi my name is awesome and I want to be your friend. Currently I am studying PYTHON. Can you help me"
words=sorted(sentence.split(" "), key=str.lower)
for w in words:
if len(w) >= 4 and len(w) <=8:
print w, len(w)
I want to print all of the words that are greater or equal to 4 and less than or equal to 8.
I am not sure where I am going wrong here, because it does not obtain ANY result.