Last active
May 11, 2019 15:27
-
-
Save niranjrajasekaran/a39a0b736346327d07c60ac126fa1d2a to your computer and use it in GitHub Desktop.
Basic implementation of python set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: s = {1, 2, 3, 4} | |
In [2]: type(s) | |
Out[2]: set | |
In [3]: s = {1, 10, 1, 3, 4} | |
In [4]: s | |
Out[4]: {1, 3, 4, 10} | |
In [5]: s[1] | |
TypeError Traceback (most recent call last) | |
<ipython-input-5-f8bb2b116405> in <module>() 1 s[1] | |
TypeError: 'set' object is not subscriptable | |
In [6]: for i in s: | |
...: print(i) | |
...: | |
1 | |
10 | |
3 | |
4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment