Error executing code in python

Good evening.

Can someone help me?
When trying to run the code below, the following error appears:

  • Code:
    print(‘Hello world’)

  • Error:

We received the following error when we ran your code:

  ImportError while importing test module '.mnt.exercism-iteration.hello_world_test.py'.
Hint: make sure your test modules.packages have valid Python names.
Traceback:
.usr.local.lib.python3.10.importlib.__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
.mnt.exercism-iteration.hello_world_test.py:3: in <module>
    from hello_world import (
E   ImportError: cannot import name 'hello' from 'hello_world' (.mnt.exercism-iteration.hello_world.py)

Hi @DM95,

Our tests run against returned values, so using a print statement isn’t going to work for them. Additionally, the stub file for Hello World had a function in it named hello, and it appears that you have deleted that function (that’s what the last line of the error stack is saying when it says ImportError: cannot import name 'hello' from 'hello_world' (.mnt.exercism-iteration.hello_world.py).

Recommend you paste the code in the linked file back into the UI and change “Goodby Mars” to a different value, and see if that changes the output. Conversely, if you write a function that returns a value, you might also get a different output from the tests.

Hope that helps, let me know if it does not. :smile:

1 Like