Skip to main content

Posts

Showing posts from August, 2020

Sets - Data type in python

Set                     Set is also one of the Data structure in python, the set is ever simple to understand, it also contains curly bracket ‘{}’ , but the only thing it will not accept duplicate value which is the same values. Let’s understand by code, Input: D = {20, 42, 111, 20, 434, ”uk”} type(D) Output: set Input: D Output: {111, 20, 42, 434, ”uk”}‘ Input: D[3] Output: --------------------------------------------------------------------------- TypeError                                 Traceback (most recent call last) <ipython-input-48-846febc3581b> in <module> ----> 1 D [ 3 ] TypeError : 'set' object is not subscriptable                            ...