It looks like you've entered the whole block as a single statement. You'll need to hit enter after entering:
def hello():
print ("Hello!")
So that the interpreter understands that this is a single definition that you've entered. Once that's been defined, then try running the hello() function.