+ 1

Search engine (SOS)

Hi guy's i cant understand, in the last section of learning python for beginning, he ask you to write a search engine, and get a word from text, i write a program he work good and get correct result, but i get always the errors. So i try to write the program differently and i still get the same error. This is the both method i write : text = input(" enter the text : ") word = input("the word to search : ") def search(text, word): for i in text : if word in text : return f"word found : {word}" else : return "word not found" print(search(text, word)) #_________________________________ text = input(" enter the text : ") word = input("the word to search : ") def search(text, word): if word in text: return f"word found : {word}" else : return "word not found" print(search(text, word) So friends if someone know where's yhe problem, help me thank you 🙏

4th Sep 2021, 1:13 PM
Mr. anrsaad
Mr. anrsaad - avatar
2 Answers
+ 5
Mr. anrsaad , i have not tested your code. but by doing code coach exercises there should be no string used in the print() function. also check the correct output and also the spelling (lower case / upper case) of the messages that should be printed. => read the instructions in the task description carefully!
4th Sep 2021, 1:19 PM
Lothar
Lothar - avatar
+ 1
As Lothar said, check the exact expected output (words, case, etc.) Don't give any argument to the input function. Iterative structure isn't mandatory.
4th Sep 2021, 9:08 PM
Delorme