+ 3

Whats wrong in this code

This is the code i am trying text = input() word = input() def search(x,y): if word in text: print("Word found") else: print("Word not found") print(search(text,word))

8th Feb 2021, 8:11 AM
Guraja Teja Surya Lokesh Kumar
Guraja Teja Surya Lokesh Kumar - avatar
2 Réponses
+ 9
Since you used x and y as parameters inside the function, you have to use those variables (x, y) instead of the original arguments (text, word). Another thing is that you dont need to print after the call of the function since the function is not returning any value. The output is already printed inside the function. https://code.sololearn.com/cf4A6qW793wq/?ref=app
8th Feb 2021, 8:18 AM
noteve
noteve - avatar
+ 2
Thanks Cyan
8th Feb 2021, 8:23 AM
Guraja Teja Surya Lokesh Kumar
Guraja Teja Surya Lokesh Kumar - avatar