Difference between args and *args

What is the difference between printing args and *args?
def fun(*args):
print(args)
print(*args)

Hey @Spartan_online, args is just a variable name over here. So if you have a function like this :

def fun(*args):
   print(args)
   print(*args)

and you call this function as :

func('Aayush',1,2,3)

*args would print all the elements that you pass as it is in the output. Whereas args would print all the values as a tuple. That’s why at all times args is used to refer to the tuple values. Tuple is iterable and convenient to print out values and use values.

I hope this helps you understand !
Happy Learning :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.