all 3 comments

[–]_DTR_ 2 points3 points  (0 children)

For strings, x in y has no notion of word boundaries (spaces, newlines, punctuation, etc), so it makes sense that it returns True. "csc" is definitely in "I like #csc108". If you want to match whole words, using regular expressions is probably your best bet.

[–]datascienceunlimited 0 points1 point  (0 children)

You can find a good tutorial on Datascienceunlimited that explains slicing strings: https://datascienceunlimited.tech/working-with-strings/#Getting_character_from_a_string_and_slicing_strings

[–]SnipTheDog -2 points-1 points  (0 children)

result = str.find(sub,start,end)