def favourite_fruit(*args):
print("My favourite fruit is : " + args[1])
favourite_fruit("Apple", "Mango", "Banana")
If you do not know how many parameters will be passed to a function then you can use arbitrary arguments in Python. In the code snippet, we have passed three fruits names and want to print the second argument passed as favorite fruit.
Here we have passed these arguments as a tuple so you can access them using its index inside the function code block.
You can also pass keyword arguments as much as you want and access them using key name inside the function code block.