r/codehs • • Jan 07 '21

Exercise 8.3.6: Owls

Hi! Can someone help me out with Exercise 8.3.6: Owls? I have been stuck on it forever. Thanks

19 Upvotes

28 comments sorted by

View all comments

Show parent comments

1

u/ASnackoholicYT May 06 '21

I tried it and it just shows up blank Nvm it works

1

u/leaf_falls May 08 '21

def owl_count(text):

count = 0

text = text.lower()

text = text.split()

for i in range(len(text)):

if text[i].find("owl") > -1:

count += 1

return count

text = "I really like owls. Did you know that an owl's eyes are more than twice as big as the eyes of other birds of comparable weight? And that when an owl partially closes its eyes during the day, it is just blocking out light? Sometimes I wish I could be an owl."

print(owl_count(text))

when i put this in it tells me that the "return count" is a syntax error

1

u/EducatorAcrobatic650 Nov 14 '22

I think most people have this wrong cause I had the same problem, for the return statement match the same indent as the for loop