Skip to content

Commit 85687a3

Browse files
Merge pull request #3 from akshaybengani789/patch-2
Create set.py
2 parents abadf6e + 2c7bb49 commit 85687a3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

set.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# set cannot have duplicates
2+
# Output: {1, 2, 3, 4}
3+
my_set = {1, 2, 3, 4, 3, 2}
4+
print(my_set)
5+
6+
# we can make set from a list
7+
# Output: {1, 2, 3}
8+
my_set = set([1, 2, 3, 2])
9+
print(my_set)
10+
11+
# set cannot have mutable items
12+
# here [3, 4] is a mutable list
13+
# this will cause an error.
14+
15+
my_set = {1, 2, [3, 4]}

0 commit comments

Comments
 (0)