+ 1
Search Engine Solution Question
https://www.sololearn.com/learn/courses/JUMP_LINK__&&__python__&&__JUMP_LINK-introduction/code-project/365164530?returnUrl=/learn/courses/python-introduction I am struggling with the 'search engine' problem at the end of Intro to Python. I feel like I am very close but there seems to be a problem in my code I cannot identify. The goal of the problem is to identify if a word is found within a sample of text. If so, output "word found" otherwise "word not found". My program accomplishes this successfully but then also outputs "none" underneath the first output. Anyone know why?
2 ответов
+ 13
Alex Andes Gascon ,
to find the issue you have, we need to see your attempt.
> please save your code in playground and link it here.
+ 4
without seeing your code, it is hard to tell where the problem is.
But I'm guessing you defined a function with a print function inside and no return value and passed this function to another print function....
def foo():
print('something')
print(foo()) --> something
None (implicit return value if there is no return)
if so, just call it, don't print it:
foo() --> something
or return the value instead of printing it:
def foo():
return 'something'
then print the return value (this time, return would not be None):
print(foo()) --> something