*args :-
Python में *args का उपयोग किसी function में किसी भी संख्या में Positional Arguments प्राप्त करने के लिए किया जाता है। Function के अंदर ये सभी arguments एक Tuple के रूप में उपलब्ध होते हैं।
English Definition: *args allows a function to accept any number of positional arguments. These arguments are collected into a tuple.
Syntax:
Example 1: Display Multiple Arguments
Output:
(10, 20, 30, 40)
Explanation:
*args एक tuple बनाता है।
args में सभी positional arguments store होते हैं।
args नाम अनिवार्य नहीं है; *numbers या कोई अन्य valid name भी इस्तेमाल कर सकते हैं।
Example 2: Find the Sum of Multiple Numbers
Output:
Example 3: Access Arguments Using a Loop
Output: