A function is a discrete section of code that performs a single, well-defined operation or a set of operations that share common logic. This tutorial will teach you the fundamentals of Python function definition. You will get an understanding of when and how to break up your code into user-defined functions.
You’ll also find out how to customise a function’s behaviour by passing in new parameters each time it’s called. In this lesson, you will discover:
-
How
functions
work in Python and why they’re beneficial -
How to
define and call
your own Python function -
Mechanisms for
passing arguments
to your function -
Some differences between how to work with functions in
Python vs C++
-
How to
return data
from your function back to the calling environment
If you already have a firm grasp of Python’s most fundamental concepts—including data types, lists, dictionaries, the import statement, conditional expressions, and for loops—this course will be very beneficial.