0

how can I print or assign *args in this scenario ?

class Test: def __init__(self,*args): self.args = *args print(self.args) t = Test(50,100,20) I am getting syntax error here.

26th Aug 2022, 5:22 AM
Levi
Levi - avatar
2 Answers
0
self.args = args # no *
26th Aug 2022, 10:12 AM
Jayakrishna 🇼🇳
0
''' In the function, we should use an asterisk * before the parameter name to pass variable length arguments.The arguments are passed as a tuple and these passed arguments make tuple inside the function with same name as the parameter excluding asterisk *. ''' self.args = args
26th Aug 2022, 10:12 AM
SoloProg
SoloProg - avatar