Good person I have the following code:
def tuplas(x):
return x[::2]
tuplas(('Hello', 'World', 'estamos', 'vivos'))
This code will work perfectly, but if I remove the parentheses from my tuple, obviously python will fail:
TypeError: tuplas() takes 1 positional argument but 4 were given
Obviously because I have just defined one argument in the function, it's actually clear that I would have to have entered an argument for each item in the tuple. I would like to be able to add a string to a string,
The question is, can I insert my data in tuple form by not putting the parentheses eg 'Hello', 'World', 'we're', 'alive' with only one argument in the function def tuple (x), not me questioning for me to put the other arguments is this output is in the same tuple form.
The function would be as follows:
def tuplas(x):
return x[::2]
tuplas('Hello', 'World', 'estamos', 'vivos') # desse modo da error
Or I would not like, I would have to put the parentheses for python to recognize this as tuple.
I hope I have been clear.