Python Functions: Built-in Functions and Multiple Return Statements

In this lesson, you’ll expand what you learned about functions in previous lessons to write better code while avoiding common pitfalls. You’ll also learn more functions concepts, such as interfering with built-in functions, function default arguments, consulting the official Python documentation, and using multiple return statements with functions.

You’ll learn how to use documentation by exploring the official Python documentation to discover new tricks you can implement in your code. Becoming familiar with the documentation and knowing how to read it is important for a data scientist; you’ll be learning constantly and exploring unfamiliar territory when writing code.

In the Variables, Data Types, and Lists in Python course, we  used commands such as print(), len(), int(), type(), and round(). In the Python Functions: Using Built-in Functions and Creating Functions lesson, you built new functions.

When writing a program, you could just keep rewriting the same code, but that would be tedious, and it would result in an unnecessarily large program. Moreover, functions are self-contained routines that perform a specific task that you can incorporate into your program. After declaring the function, you can use the function anytime to save time and resources. A function displays these patterns: it takes an input, transforms the input, and returns an output.

As you go through this lesson, you’ll have the opportunity to practice your skills with our interactive code editor with built-in answer-checking to ensure you have completely mastered each concept before moving on to the next.


  • Learn how to troubleshoot interactions with built-in functions
  • Learn how to define default function arguments
  • Learn how to use official Python documentation
  • Learn how to employ multiple return statements

Lesson Outline

  1. Interfering with the Built-in Functions
  2. Variable Names and Built-in Functions
  3. Default Arguments
  4. The Official Python Documentation
  5. Multiple Return Statements
  6. Not Using the else Clause
  7. Review
  8. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.