+ 2
In python sequences are of 3 types i.e list,tuples, dictionaries.But in some websites iam finding sets as well. Is it true??
2 ответов
+ 1
In python, those lists, tuples, dictionaries are data structures - "some ways to represent basic data". In addition to these sets are also a data structure, in contrast, that does not allow dublicate values. Where as list, tuples, allows dublicates.
0
A sequence has to have an order. Sets and dictionaries are not ordered, so they wouldn't count as sequences in the strict sense.
I'm wondering, though... since dicts now remember the order in which stuff was entered, are they hybrids now?
I'd only consider lists, tuples, strings, bytestrings and such types as sequences.