What does this function call print?
def greet(name):
return "Hi " + name
print(greet("Ana"))Options
- Hi Ana (Correct option)
- greet
- Hi name
- 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.