36 Answers
New Answertext = input() word = input() def search(text, word ): if word in text: print("Word found") else: print("Word not found") print(search(text, word)) #All test caises fail because it outputs None added to the correct output. Plz. Help.
2/17/2021 11:05:56 AM
Mohamed Mehdi Gara36 Answers
New AnswerWith 'print' inside a function, you don't need the outside one .It prints 'none' because the function do not return a value. So, you have to remove the last print statement to avoid it. search(text,word)
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) This will work 100%.👍
text = input() word = input() def search(text, word): if word in text: print('Word found') else: print("Word not found") search(text, word) Try this
Try this: text = input() word = input() def search(text, word): #for i in word: if word in text: a ="Word found" return a else: b = "Word not found" return b print(search(text, word))
def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word) This will work 100%.👍
text = input() word = input() def search(text, word ): if word in text: print("Word found") else: print("Word not found") print(search(text, word)) please help us by this code error
❤️😍Prerana 😍❤️ thought your code was correct and understood it so copy and pasted but it failed due to the print statement but thank you simple fix to a return statement text = input() word = input() def search(text, word ): if word in text: return "Word found" else: return "Word not found" print(search(text, word))
1. sentence=input("Enter a sentence:") 2. particular_word=input("Enter a particular word:") 3. def findin_word(sentence,particular_word): 4. if(particular_word in sentence): 5. return(particular_word + " is found in " +sentence) 6. else: 7. return("not found") 8. print(findin_word(sentence,particular_word)) It's only for knowledge.it will not work on sololearn project
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message