def minimum (*n):
print(n)
minimum(1)
minimum(1,2)
def func(*args):
print(args)
values1 = (1,2)
values2 = ((1,2), (3,4))
func(values1)
func(values2)
OUTPUT:
(1,)
(1, 2)
((1, 2),)
(((1, 2), (3, 4)),)
Process finished with exit code 0
First O/p:
I think python is expecting multiple arguments to be passed so there is a comma (,) after 1. ?
Second O/p:
Now the python sees multiple arguments being passed there is no comma. It stores the args a tuple?
Third O/p and Fourth O/p:
Why is there still a comma? even after I passed 2 tuples assuming that python is expecting multiple tuples like the above?
Help me understand this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…