0

Why my code ain't working?

def search(text ,word): text = input() word = input() n = text.count(word) if n >= 1: print("Word found") else: print("Word not found") print(search(text, word))

30th Apr 2021, 2:34 PM
Лубягин Кирилл
Лубягин Кирилл - avatar
4 Antworten
+ 3
sarada lakshmi Лубягин Кирилл Yes but no need to print function if you have already printed value in function because it may give None also because you are not returning anything in function. Simply call the function. Да, но нет необходимости печатать функцию, если вы уже напечатали значение в функции, потому что это может дать None также потому, что вы ничего не возвращаете в функции. Просто вызовите функцию. def search(text, word): n = text.count(word) if n >= 1: print("Word found") else: print("Word not found") text = input() word = input() search(text, word)
30th Apr 2021, 3:10 PM
A͢J
A͢J - avatar
+ 2
Лубягин Кирилл Try this one: def seacrh(text,word) : if word in text : print ('Word found') else: print('Word not found') text = input() word = input() seacrh(text,word)
30th Apr 2021, 10:02 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
Yeah.. 😂 Thanks for correcting me 🅰🅹 🅐🅝🅐🅝🅣
30th Apr 2021, 3:28 PM
sarada lakshmi
sarada lakshmi - avatar
0
Please Check indentation and code as well.. It's not the proper way of writing code. def search(text ,word): n = text.count(word) if n >= 1: print("Word found") else: print("Word not found") text = input() word = input() print(search(text, word)) It shld be smthg like this. 👆👆
30th Apr 2021, 2:39 PM
sarada lakshmi
sarada lakshmi - avatar