Hi there. I just got my Codewars account to start working on my Python basic skills. For the first challenge, I’m asked to "Make a simple function called greet that returns the most-famous “hello world!”
So I wrote the following code:
def greet():
print(“Hello world!”)
greet()
But this code doesn’t solve the test. It says:
“‘Greet’ (the function) doesn’t return hello world!: None should equal ‘hello world!’”…
So what is the issue? because I can’t see it…
I have run this code on Pycharm and it returned “Hello world!”
Hi Fish…
It looks like you are on the right track, But I have question.
Q. Is the code in your function shown exactly as above or did you use indentation?
BTW, You don’t always need the ‘return’ command, indentation is key. I usually like 4 spaces.
HTH
I think this error message implies the testing code is expecting a return value. The function does not have return statement, so it’s return value is None, and therefore the message says “None (the return value) should equal ‘hello world!’”.