Python 3

Functions with Two or More Parameters in Python

In Python, we can define functions to make our code reusable, more readable, and organized. This is the basic syntax of a Python function:

Tip: a function can have zero, one, or multiple parameters.

To define two or more parameters, we just separate them with a comma:

Example:

Now when we call the function, we must pass two arguments:

We can adapt the function that we just saw with one parameter to work with two parameters and print a pattern with a customized character:

You can see the output with the customized character is that we call the function passing the two arguments:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.