0
How to find a word in a group of letters (python)
For example: x=input() #lets say that the user typed in ‘iowbchandlekv’ and now I want to check if ‘hand’ as a whole word is in x, how would I do this?
4 odpowiedzi
+ 2
try this:
https://code.sololearn.com/cVTGoZ9c279v/?ref=app
if you want to see if a contains b then you can use:
b in a #or
a.find(b)!=1
+ 1
Just iterate through the string and compare each character ( you can use the casefold function to make it suitable for caseless comparisions)
0
I forgot one of my questions, how would I cut off everything before hand now that it has been found?
0
str.find(word) should suffice