python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python

hi guys, i need some help in coding a Python project which is about searching a word in a text. would someone help me please?

5th Sep 2022, 5:40 PM
shahrzad
4 Answers
+ 3
shahrzad , we may help you, if you can give us some more information. it sounds like a tutorial exercise. > please mention the tutorial name and exercise number. > please also include a link to your code.
5th Sep 2022, 5:52 PM
Lothar
Lothar - avatar
+ 2
Hi! Please, show us your code here. And then we can help you.
6th Sep 2022, 6:17 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Hi! Here is the question: You’re working on a search engine. Watch your back Google! The given code takes a text and a word as input and passes them to a function called search(). The search() function should return "Word found" if the word is present in the text, or "Word not found", if it’s not. And my code which im not sure its correct : text = input() word = input() def search(x,y): x.split(" ") y=str if y==x: print("Word found") else : print("Word not found") print(search(text, word))
6th Sep 2022, 8:59 AM
shahrzad
+ 1
move else to the left so that it is clearly in the same even vertical line with if. and remove the print command in last line. call the function by its name. no print. your program will be launched. and read carefully lesson 31.1 python for beginners
6th Sep 2022, 10:00 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar