You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
203 B
18 lines
203 B
11 years ago
|
# basic sets
|
||
|
|
||
|
s = {1}
|
||
|
print(s)
|
||
|
|
||
|
s = {3, 4, 3, 1}
|
||
11 years ago
|
print(sorted(s))
|
||
9 years ago
|
|
||
8 years ago
|
# expression in constructor
|
||
|
s = {1 + len(s)}
|
||
|
print(s)
|
||
|
|
||
9 years ago
|
# Sets are not hashable
|
||
|
try:
|
||
|
{s: 1}
|
||
|
except TypeError:
|
||
|
print("TypeError")
|