Variable Length Arguments in PythonLast Updated : 17 Mar 2025 We have tried and learned the different ways of defining and calling a function in our program. In this article, we will discuss what are the variable-length arguments in Python. Here we will cover two types-
Non - Keyworded Arguments (*args)First let us understand the properties of *args,
The program given below illustrates the same, Output: Let us study Data Science and Blockchain Explanation- Let's understand what we have done in the above program,
Let's have a look at one more program based on *args. Output: The first parameter is: Let The second parameter is: us study Data Science and Blockchain Explanation- It's time to have a glance at the explanation of this program.
Now let us understand what is a keyworded argument or **kwargs in Python. Keyworded Arguments (**kwargs)Here we can pass a keyworded variable-length argument. Some of its characteristics are-
Consider the program given below, Output: a_key=Let b_key=us c_key=study d_key=Data Science e_key=and f_key=Blockchain Explanation- Let us see what we have done in the above program.
Consider one more program given below based on **kwargs. Output: b_key=us c_key=study d_key=Data Science e_key=and f_key=Blockchain Explanation- Check out the explanation of this program,
We will conclude this article with a program that illustrates how *args and **kwargs can be used in a single program. Output:
The value of args is: ('Let', 'us', 'study')
The value of kwargs is: {'a_key': 'Data Science', 'b_key': 'and', 'c_key': 'Blockchain'}
Explanation-
ConclusionIn this article, we learned what are variable-length arguments in Python and how they can be used in our function. Next TopicPython file truncate method |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India