What is a tuple useful for?

后端 未结 11 795
天涯浪人
天涯浪人 2021-02-01 12:45

I am learning Python for a class now, and we just covered tuples as one of the data types. I read the Wikipedia page on it, but, I could not figure out where such a data type wo

11条回答
  •  遇见更好的自我
    2021-02-01 13:11

    I like this explanation.

    Basically, you should use tuples when there's a constant structure (the 1st position always holds one type of value and the second another, and so forth), and lists should be used for lists of homogeneous values.

    Of course there's always exceptions, but this is a good general guideline.

提交回复
热议问题