Repaso
EspaƱol
PythonFoundationsPY-64

What does this function call print?

def greet(name):
    return "Hi " + name

print(greet("Ana"))

Options

  1. Hi Ana (Correct option)
  2. greet
  3. Hi name
  4. Nothing at all

Answer

Hi Ana

Why

def defines a function: a named block of code that you can run whenever you want.

greet("Ana") calls it, giving "Ana" as the argument for the parameter name.

return sends a value back to whoever called the function. print then shows that value.

So "Hi " + "Ana" gives Hi Ana.

Remember

def defines a function. return gives back a value.

Key terms

Practice this question in Repaso