+ 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())
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"
+ 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.
+ 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
+ 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.
+ 1
You defined a function...
But u didn't call it so it won't execute
0
This code is wrong, i want to find the mistakes
- 2
Noā¹