Introduction

Completed

Using a Python function is the first step into coding after basic conditionals and data structures. Functions allow reusability, which avoids duplication of code. When projects reuse code with functions, they become more readable and maintainable.

Scenario: Organize data about a rocket

Imagine you're creating a program to construct precise information about a space rocket. Reusable functions allow you to not just compute information but also compose new values by mixing inputs and outputs from other functions.

What will I learn?

In this module, you'll learn to:

  • Use default, required, and wildcard inputs.
  • Make code reusable by extracting common patterns into separate functions.
  • Return values, data structures, or computed results.

What is the main objective?

By the end of this module, you'll understand some of the rules and behavior associated with functions, including how to handle inputs and outputs.

Prerequisites

You should be familiar with the concept of programming.

You don't need to install Python to complete this module. You'll use an interactive sandbox to complete the exercises.

If you want to try out the code in the explanations, you might want to work through Get started with Python in Visual Studio Code first, if you haven't already. This module helps you prepare a Python environment.