Tuple

Tuple An immutable data value that contains related elements. Tuples are used to group together related data, such as a person's name, their age, and their gender.

 

Heterogeneous(异构) can be composed of elements of different types.

year_born = ("Paris Hilton", 1981)

 

students = [

    ("John", ["CompSci", "Physics"]),

    ("Vusi", ["Maths", "CompSci", "Stats"]),

    ("Jess", ["CompSci", "Accounting", "Economics", "Management"]),

    ("Sarah", ["InfSys", "Accounting", "Economics", "CommLaw"]),

    ("Zuki", ["Sociology", "Economics", "Law", "Stats", "Music"])]

 

Packing & Un-Packing

 

Reference<How to Think Like a Computer Scientist>

posted on 2015-10-02 11:33  vczh_tonyc  阅读(142)  评论(0编辑  收藏  举报

导航