12th Sep 2021, 11:23 AM
Aakash Mitra
Aakash Mitra - avatar
8 Respostas
+ 2
Aakash Mitra do this, search(text, word) instead of print(search(text, word)) _______________________ For print to print some value (other than None), search function needs to return a value.
12th Sep 2021, 11:32 AM
Abhay
Abhay - avatar
+ 4
Because you are printing a function that contains a print() function. The output of printing print() is None. If you are going call your function by putting it in a print() function, then don't have your function print the word results, just return them. E.g. if word in text: return "Word found" else: return "Word not found" then print(search(text, word)) should work. Alternatively, if your function says if word in text: print("Word found") else: print("Word not found") Then simply call the function by saying search(text, word) And that should also work.
12th Sep 2021, 11:37 AM
David Ashton
David Ashton - avatar
+ 1
Because search function doesn't returns a value and so printing it prints None by default. just call the function instead of printing it as well.
12th Sep 2021, 11:26 AM
Abhay
Abhay - avatar
0
Abhay so now what i can do to solve it
12th Sep 2021, 11:27 AM
Aakash Mitra
Aakash Mitra - avatar
0
Aakash Mitra just call the function .
12th Sep 2021, 11:28 AM
Abhay
Abhay - avatar
0
Abhay sorry but can you explain me in a easier way or explain me by making it yourself
12th Sep 2021, 11:31 AM
Aakash Mitra
Aakash Mitra - avatar
0
Abhay Thanks bro
12th Sep 2021, 11:34 AM
Aakash Mitra
Aakash Mitra - avatar