- 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")
8 Réponses
+ 3
Sami Golzadeh Do what Slick told you "just call the function no need to print it " .
+ 3
You called search() before defining it. Take line 3 and move it to the bottom. Also, indent those if and else blocks
+ 2
Yup, cause you print a function that returns None. Just call the function, no need to print it
+ 1
You are calling the function before it is defined. The function can only be called after it is defined.
+ 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.
0
I have correct it but it writes none under the output
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))
0
So how can I fix it