E
E
Epic182020-07-15 10:20:56
Python
Epic18, 2020-07-15 10:20:56

Creating lists and tuples?

Python has list( ) and tuple( )

functions Why do these functions require arguments to be given in square and parentheses, doesn't look very nice with double brackets ps I know that without a function they can be created like this
m_tuple = tuple( (1, 2, 3) )

m_tuple = (1, 2, 3)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Yakushenko, 2020-07-15
@Epic18

requires arguments to be specified in square and round brackets

They require any iterable object, not square brackets or parentheses, to make a list or tuple out of it. So it is possible list((1, 2, 3))and so too list('abc').

D
Dimonchik, 2020-07-15
@dimonchik2013

program more

U
User Unknown, 2020-07-15
@aveBHS

m_tuple = tuple( (1, 2, 3) )
And actually what for to do a cortege from a cortege?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question