- 3

What is the problem?

text = str(input()) word =str(input()) print(search(text, word)) def search(a, b) : if str(b) in str(a) : print("Word found") else : print("Word not found")

3rd Sep 2021, 7:06 AM
Sami Golzadeh
Sami Golzadeh - avatar
8 odpowiedzi
+ 3
Sami Golzadeh Do what Slick told you "just call the function no need to print it " .
3rd Sep 2021, 8:06 AM
Abhay
Abhay - avatar
+ 3
You called search() before defining it. Take line 3 and move it to the bottom. Also, indent those if and else blocks
3rd Sep 2021, 7:12 AM
Slick
Slick - avatar
+ 2
Yup, cause you print a function that returns None. Just call the function, no need to print it
3rd Sep 2021, 7:19 AM
Slick
Slick - avatar
+ 1
You are calling the function before it is defined. The function can only be called after it is defined.
3rd Sep 2021, 7:13 AM
Josiah Mathieu
Josiah Mathieu - avatar
+ 1
And don't waste code writing str(input()). Just write input(), which ALWAYS returns a string. That's why you have to use int(input()) to convert input into an integer.
3rd Sep 2021, 12:06 PM
David Ashton
David Ashton - avatar
0
I have correct it but it writes none under the output
3rd Sep 2021, 7:18 AM
Sami Golzadeh
Sami Golzadeh - avatar
0
text = str(input()) word = str(input()) def search(a, b) : if str(b) in str(a) : print("Word found") else : print("Word not found") print(search(text, word))
3rd Sep 2021, 7:18 AM
Sami Golzadeh
Sami Golzadeh - avatar
0
So how can I fix it
3rd Sep 2021, 7:26 AM
Sami Golzadeh
Sami Golzadeh - avatar