Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Defining and Calling Python Functions (Overview)

A function is a self-contained block of code that encapsulates a specific task or related group of tasks. This course will show you how to define your own Python function. You’ll learn when to divide your program into separate user-defined functions and what tools you’ll need to do this.

You’ll also learn the various ways to pass data into a function when calling it, which allows for different behavior from one invocation to the next.

In this course, you’ll learn:

  • 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

This course will be the most helpful for you if you’re already familiar with the fundamental concepts of Python, including basic data types, lists and tuples, dictionaries, the import statement, conditional statements, and for loops.

Download

Sample Code (.zip)

12.9 KB

Download

Course Slides (.pdf)

2.9 MB

Become a Member to join the conversation.