help me in end project of python begginer | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

help me in end project of python begginer

guys this is my solution for end project of search engine but it is not correct in all cases plz help me if u have different solution text = input() word = input() def search(x,y): if text.find(word): return "Word found" else: return "Word not found" print(search(text,word))

11th Mar 2021, 3:11 PM
pardeep
pardeep - avatar
5 Antworten
+ 4
You can also try it in this way : text = str(input()) word = str(input()) def search(text,word): text = text.split(' ') if word in text: return("Word found") else: return("Word not found") print(search(text,word))
11th Mar 2021, 4:44 PM
Aysha
Aysha - avatar
+ 4
pardeep def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) This may helps you. Happy coding 🤘
12th Mar 2021, 8:30 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 2
string.find function will return -1 if the word is not found not 0 -1 is a truth value, so you cant simply do if string.find(otherstring): else: try if string.find(otherstring) == -1:#word not found else:#word found or otherwise
11th Mar 2021, 3:26 PM
durian
durian - avatar
+ 2
thanks miss
12th Mar 2021, 12:58 AM
pardeep
pardeep - avatar
+ 1
thanks
11th Mar 2021, 4:22 PM
pardeep
pardeep - avatar