The first output shows a comma because without it, 1
being the only element, (1)
would be just a integer (parentheses are wrapping the expression 1
), (1,)
is shown to differentiate tuples and simple parentheses.
in the second one, no trailing comma is needed to differentiate tuples, since there are more than one element.
In the third O/p, you are not passing 1
and 2
, but instead you’re passing the whole (1,2)
, so it shows only one item (which is (1,2)
) in a tuple, and adds an extra comma. Same for the fourth: your passing the entire ((1,2), (3,4))
.
solved variable positional and printing the values