## Key Concepts

Review core concepts you need to learn to master this subject

### Function Parameters

``````.gamut-clns7e-ColorizedContainer-fontSmoothing{display:block;text-align:left;font-weight:normal;background-color:#211E2F;color:#939598;font-family:Monaco,Menlo,"Ubuntu Mono","Droid Sans Mono",Consolas,monospace;font-size:0.875rem;padding:1rem;overflow-wrap:break-word;white-space:pre-wrap;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}def write_a_book(character, setting, special_skill):
print(character + " is in " +
setting + " practicing her " +
special_skill)``````

Sometimes functions require input to provide data for their code. This input is defined using parameters.

Parameters are variables that are defined in the function definition. They are assigned the values which were passed as arguments when the function was called, elsewhere in the code.

For example, the function definition defines parameters for a character, a setting, and a skill, which are used as inputs to write the first sentence of a book.

Introduction to Functions
Lesson 1 of 1
1. 1
In programming, as we start to write bigger and more complex programs, one thing we will start to notice is we will often have to repeat the same set of steps in many different places in our progra…
2. 2
Let’s come back to the trip planning application we just discussed in the previous exercise. The steps we talked about for our program were: 1. Establish an origin and destination 2. Calculate …
3. 3
A function consists of many parts, so let’s first get familiar with its core - a function definition. Here’s an example of a function definition: def function_name(): # functions tasks go he…
4. 4
Now that we’ve practiced defining a function, let’s learn about calling a function to execute the code within its body. The process of executing the code inside the body of a function is known as …
5. 5
Consider our welcome function for our trip planning application: def trip_welcome(): print(“Welcome to Tripcademy!”) print(“Let’s get you to your destination.”) The print statements all ru…
6. 6
Let’s return to our trip_welcome() function one more time! Let’s modify our function to give a welcome that is a bit more detailed. def trip_welcome(): print(“Welcome to Tripcademy!”) print(“L…
7. 7
Using a single parameter is useful but functions let us use as many parameters as we want! That way, we can pass in more than one input to our functions. We can write a function that takes in mor…
8. 8
In Python, there are 3 different types of arguments we can give a function. * Positional arguments: arguments that can be called by their position in the function definition. * Keyword arguments…
9. 9
There are two distinct categories for functions in the world of Python. What we have been writing so far in our exercises are called User Defined Functions - functions that are written by users …
10. 10
As we expand our programs with more functions, we might start to ponder, where exactly do we have access to our variables? To examine this, let’s revisit a modified version of the first function we…
11. 11
At this point, our functions have been using print() to help us visualize the output in our interpreter. Functions can also return a value to the program so that this value can be modified or use…
12. 12
Sometimes we may want to return more than one value from a function. We can return several values by separating them with a comma. Take a look at this example of a function that allows users in our…
13. 13
Excellent work! 👏 In this lesson, you’ve covered a major fundamental programming concept used in the majority of all programs to organize code into reusable blocks. To recap, we explored: - What …

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory