Python Function Arguments In Python, you can define a function that takes variable number of arguments. In this article, you will learn to define such functions using default, keyword and arbitrary arguments. Arguments In the user-defined function topic, we learned about defining a function and calling it. Otherwise, the function call will result in an error. Here is an example. def greet (name, msg) : """This function greets to the person with the provided message""" print ( "Hello" , name + ', ' + msg) greet( "Monica" , "Good morning!" ) Output Hello Monica, Good morning! Here, the function greet() has two parameters. Since we have called this function with two arguments, it runs smoothly and we do not get any error. If we call it with a different number of arguments, the interpreter will show an error message. Below is a call to this function with one and no arguments along with their respective...
Comments