Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Function basics
5. Function parameters


Perfect. Next, functions can take arguments, or input parameters.

def say_my_name(name):
  print('Hello, ' + name + '!')

In the parentheses after the function name, we provided a single parameter called name. Parameters can have any names you want, but they should be meaningful and describe what the parameters denote. Next, we used the parameter inside the function. In this way, the function will produce different outputs based on the input parameter. You may also have noticed that we used the + instead of ,. You can always use it to concatenate strings.


Define a function named print_numbers_to(number) that prints all natural numbers from 1 up to the number argument. Assume that number will be a valid integer from 2 to 1000.

Next, invoke the function with the argument 50.

Stuck? Here's a hint!

Use the following loop inside the function:

for i in range (1, number+1):