Passing arguments
Lesson 7 of 19 in Coddy's Into the Past || Complete Beginner for Python Strings course.
Optional arguments
We are now going to look at the optional argument with a python function. An argument is the ability to pass information into a function.
The technique used is place the argument inside the parentheses and separate them by a common if you have more than one.
Example:
def my_name(name):
return nameAs you can see the argument name is referenced and returned
Challenge
EasyNow run the code that is given to you in the code editor and see for yourself
Try it yourself
def my_name(name):
return name