# basics functions

Functions Calling Functions

Functions can call other functions you've written — this is called composition, and it's a great way to build bigger things out of small, simple pieces:

def double(n):
    return n * 2

def quadruple(n):
    return double(double(n))

print(quadruple(3))

prints: 12

Your turn: we've already read a number into n for you. Define double(n) returning n * 2. Define quadruple(n) that calls double twice to quadruple its input, then print quadruple(n).

💡 need a hint?

pyb-func-composition.py🔒 given lines are locked — write your code in between
loading...