Defining and Calling Python Functions

Howard Francis
Howard Francis 27 Lessons 2h 23m basics python

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.

What’s Included:

Downloadable Resources:

Related Learning Paths:

The return Statement

3 Lessons 16m

Keyword-Only and Positional-Only Arguments

3 Lessons 18m

About Howard Francis

Howard is an avid Pythonista and records video courses for Real Python. He has been teaching beginning programming at the college level for over 20 years in C++, Java, C#, and most recently Python.

» More about Howard

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

silvanog31560 on Aug. 9, 2021

Thank you for this course, it was great! I am sure that once I get some practice I will come back to review this again!

« Browse All Courses