Please help. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help.

Given code takes a text and word as input and passes them to a function called search(), which should retured "world found" if word is present in the text, else "world not found" if it is not. def search(input): text= input() word= input() If word in text: return("world found") else: return("world not found") print(text())

31st Aug 2022, 2:01 PM
Tamara Danielyan
7 Answers
+ 4
Tamara Danielyan , here a summery of the issues the code has: > wrong indentation (multiple cases) > function search() is never called, so it is not executed > function search is declared to have a parameter (input) that is not required > call of a function text() that does not exist as already mentioned, you should start learning from the tutorial: " python for beginners"
31st Aug 2022, 5:27 PM
Lothar
Lothar - avatar
+ 2
Save your code in Sololearn Playground and provide the link here. Then you can see what errors are displayed after running of this code.
31st Aug 2022, 2:21 PM
JaScript
JaScript - avatar
+ 2
Code takes a text, and word as input and passes to function search() means text = input() word = input() search( text, word) # is the call to function by passing input values.. Chenge function definition to accept this call also... In your code, text is a variable, not function name. text() error. And check spelling "Word found".. You spelled wrong "world" in both times.., check about case sensitive also.... if => small i. not the capital I
31st Aug 2022, 2:47 PM
Jayakrishna 🇮🇳
+ 2
Tamara Danielyan I did look on your profile. You did not start any Python tutorial. That's what I want to recommend to you at the beginning is to complete one.
31st Aug 2022, 3:00 PM
JaScript
JaScript - avatar
+ 1
You defined a function... But u didn't call it so it won't execute
2nd Sep 2022, 3:51 AM
Mohsen Farahi
Mohsen Farahi - avatar
0
This code is wrong, i want to find the mistakes
31st Aug 2022, 2:20 PM
Tamara Danielyan
- 2
No☹
31st Aug 2022, 2:39 PM
Tamara Danielyan