Parameters

Functions can also have inputs, called parameters. We have already used functions with paramentes before! When we run print("Hello World"), we are running the print function with the parameter "Hello World". Here's how to create a function with a parameter.

def make_something(thing): print("Here's your " + thing) make_something("cake") make_something("ice cream") make_something("ice kachang")

In the above example, thing is a special variable. It contains the input provided when we run make_something and it only exist inside the make_something function.

We can also have more than one parameters. To do so, separate them with a comma ,. Here's an example.

def make_many_things(thing, number): for a in range(number): print("Here's your " + thing) make_many_things("cake", 3)