- 3
The given code takes a text and a word as input and passes them to a function called search().
error in my code , can you point it out??
13 Réponses
0
Please give me correct code.
0
Oh right:
#this is the real code I used to pass the module:
def search(text,word):
res = ""
if word in text:
res = "Word found"
else:
res = "Word not found"
return res
text = input()
word = input()
print(search(text, word))
0
Ervis Meta
Thank you very much...
0
def search(text_,word_):
if word_ in text_ and word_:
return "Word found"
else:
return "Word not found"
text=input()
word=input()
print(search(text,word))
0
Ratnapal Shende
Thank you very much...
0
Siddhartha Kushwaha Here's a possible solution:
def search(text, word): return word in text
# Hope this helps
0
Your Queue class is up and working in a customer service company. The company opens up a new branch and asks you to make another version of the Queue for them. The only difference is the way the Queue is displayed: each number on a new line.
You decide to create a new class called Queue2, which is derived from the Queue class and overrides the print() method, outputting each element of the queue on a new line.
0
Help C++
- 1
My attempts:- def search():
text = input()
word = input()
if search == word:
return text
print("Word found")
elif search ≠ text:
return text
print("Word not found")
print(search(text, word))
- 1
Why do you stress youself with this long code.
I think this is more readable :
def search(word,text):
result = None
if word in text:
result = True
else:
result = False
return result
- 1
Ervis Meta
It is not executing your code.
I don't know why.
This is last code project in Python for begginers.
- 1
def search(word, text):
text = input()
word = input()
if word in text:
return text
print("Word found")
if word not in text:
return text
print("Word not found")
## In this code 3 test cases are correct and 3 test cases are wrong.
- 1
No problem 😃👌