-3

I'm using the latest spyder/anaconda (Python 3.8) software and a beginner here. When running a simple hello.py script. I get runfile('C:/Users/Raj/CODE/Python Scripts/hello.py', wdir='C:/Users/Raj/CODE/Python Scripts') but nothing else in the console or anywhere saying "Hello World".

def hello():
    """Print "Hello World" and return None."""
    print("Hello World")

It can do other print type scripts just fine as I tried an old script from college.

wovano
  • 4,543
  • 5
  • 22
  • 49

2 Answers2

1

Any function needs to be called in order to get executed. You call a function by typing it's name with the (), in your case hello()

MercifulSory
  • 337
  • 1
  • 14
1

on bottom of the python file add the call to the function hello

hello()
Ronen
  • 189
  • 3