Why does my python find() print say 20

i put code god_wills_it_line_one = “The very earth will disown you”

disown_placement = god_wills_it_line_one.find(“disown”)

print(disown_placement)

and it printed 20 instead of 4
photo

Hello!

Can you please share your code formatted according to this: How do I format code in my posts?? :slight_smile:

Edit: Sorry that’s my bad, totally missed it in your first post!

of cores i will help you

"disown" starts at 21st character in the string stored in god_wills_it_line_one
(the index of the d in disown is 20)

thank you so mutch see you next time

Your code is looking for the first index where “disown” is found.
god_wills_it_line_one is a string, not a list of words.
So-- [20] is the index (based on characters not words) where the word “disown” is first found.

1 Like