Home > Back-end >  Trying to run my python script doesnt do anything
Trying to run my python script doesnt do anything

Time:03-19

Sorry for the vague title, but I am unsure how else to explain it. Running the command in terminal:

python --version

Outputs:

Python 3.9.10

When I try to run my main.py file using the command: python main.py or python3 main.py nothing outputs. I am new to Python and this was just working but I restarted my computer and now I cant get any of my Python scripts to output or run.

This is all that my main.py is:

def main():
    print("hello world")

Does anyone have any ideas?

CodePudding user response:

You have to call the function:

def main():
    print("hello world")

main()

CodePudding user response:

You need to call the method. Just defining a method is not enough to run it.

Try this:

def main():
    print("hello world")

main()
  • Related