In function I've defined two arguments 1:default variable say age=12 and 2:variable-length argument say *friends
def variable(age=12,*friends):
print 'Age:', age
print 'Name:', friends
return
variable(15,'amit','rishabh') # RESULT is "Age: 15 & Name: 'amit', 'rishabh'
variable('rahul','sourabh') # Now here result is Age: rahul & Name: 'sourabh'
so my question is why function does'nt take both this arguments in *friends variable why it determine the first argument as age.
I need result should be in this format as:
variable(15,'name','surname') as Age:15 and Name: 'name','surname'
and if I don't assign age as
variable('new','name') Result needed to be as. Age:12 & Name:'new','name'
typeif that's the behavior you are after...