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.
2 Respuestas
0
self.args = args # no *
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