If you are typing greet(Paul) then, here, Paul is the name of a variable and, if you haven't defined a variable named Paul in your computer/notebook then you will get a NameError.
If you write somewhere earlier in your notebook: Paul = "test 123" then your function will return "Hello, test 123..." and no longer get the NameError since now you have defined a variable named Paul.
Whereas when you type greet("Paul") you are passing the string "Paul" as an argument, so the function executes as you would expect, using "Paul" wherever name appears in the function body.
If you are typing
greet(Paul)
then, here,Paul
is the name of a variable and, if you haven't defined a variable namedPaul
in your computer/notebook then you will get aNameError
.If you write somewhere earlier in your notebook:
Paul = "test 123"
then your function will return"Hello, test 123..."
and no longer get theNameError
since now you have defined a variable namedPaul
.Whereas when you type
greet("Paul")
you are passing the string"Paul"
as an argument, so the function executes as you would expect, using"Paul"
wherevername
appears in the function body.