Python Forum
Exercism with Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Exercism with Python (/thread-36642.html)



Exercism with Python - Gyga_Hawk - Mar-13-2022

Hello

This is my first post on this forum
I am new to Python and programming

I would like to do the first exercise on exercism, The Hello World exercise
but when I follow the coding pattern, it just doesn't work, I do it on their online editor,

Is here anyone has experienced the same issue?

Thank you very much


RE: Exercism with Python - Larz60+ - Mar-13-2022

so what does your code look like?
Please post.


RE: Exercism with Python - Gyga_Hawk - Mar-15-2022

Hello

Thank you very much for your kind reply


Here is my code is under the hash signs,

def hello():
    print("hello world")
    return 'Goodbye, Mars!'

########
Print (Hello World)



RE: Exercism with Python - Yoriz - Mar-15-2022

Print should be all lower case and you need to call the function hello
def hello():
    print("hello world")
    return "Goodbye, Mars!"


########
print(hello())
Output:
hello world Goodbye, Mars!



RE: Exercism with Python - Gyga_Hawk - Mar-17-2022

Hello

I got the message on the screenshot,
kindly check it

thank you


RE: Exercism with Python - Yoriz - Mar-17-2022

What does the test says it expects your function to return, compared to what you have actually returned?


RE: Exercism with Python - ndc85430 - Mar-17-2022

Do you understand the difference between printing and returning?


RE: Exercism with Python - Gyga_Hawk - Mar-17-2022

No I Don't know what is the difference between two these,
could you explain to me please?
Thanks





(Mar-17-2022, 06:57 AM)ndc85430 Wrote: Do you understand the difference between printing and returning?



RE: Exercism with Python - ndc85430 - Mar-18-2022

When you return a value from a function, it can be used in subsequent parts of the program (assigned to a variable, passed to another function as in the test, etc.). Printing doesn't do that - the value is simply written to the console.

That is to say the console is external to your program, not part of it.