2013-12-29 22:34:42 +00:00
|
|
|
# basic sets
|
|
|
|
|
|
|
|
s = {1}
|
|
|
|
print(s)
|
|
|
|
|
|
|
|
s = {3, 4, 3, 1}
|
2014-04-07 00:42:09 +01:00
|
|
|
print(sorted(s))
|
2015-08-28 20:31:31 +01:00
|
|
|
|
2016-09-30 06:00:15 +01:00
|
|
|
# expression in constructor
|
|
|
|
s = {1 + len(s)}
|
|
|
|
print(s)
|
|
|
|
|
2015-08-28 20:31:31 +01:00
|
|
|
# Sets are not hashable
|
|
|
|
try:
|
|
|
|
{s: 1}
|
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|