Topic Overview and Lesson Plan

Hello, Space Explorer! Today, our focus is on calling functions in Python. By the end of the lesson, you'll understand how to call functions, utilize transitive function calling, employ named parameters, and return multiple values from a function.

Understanding Function Calling in Python

Much like how using a remote control can switch on your television, calling a function tells Python to execute a block of code. It's akin to giving directions to your spaceship's computer. Let's use a common scenario in space journeys: greeting a new crew member. Consider this example:

In this instance, we instructed our spaceship's computer to greet the new team member, Astro Kid! Just as in saying "Hello" to a new crew member, calling a function executes the predefined code within that function.

Practical Explanation of Transitive Function Calling

In spaceship jargon, think of transitive function calling as delegating tasks on board your spacecraft. So, in fact, transitive function calling is just when you call one or multiple functions inside another function, delegating execution. Suppose we want to increase the heat in our spaceship's engine — instead of doing it ourselves, we assign the task to another function:

Here, as we prepare to launch the spacecraft, we call another function — power_up_engine(3) — to power up our spacecraft's engine. Afterward, we call another function - to delegate the processing of engine post-startup operations. You can see how one function can call another to perform a task.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal