Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

difference between set and list in python

'''
In python, a list is a collection of values in a specific order.
There can be several times the same value
[4,8,9,5,4,1,3,4] is a valid list in python

In a set, all values have to be unique
and there is no order like in a list or a tuple.

It is better to use sets compared to lists as much as possible,
because of its speed to retrieve data and space memory economy.
For instance, if you want to store usernames, a set is better than a list
because you don't care about the order and usernames are supposed to be
unique.

Diferent methods are available for sets and lists.
I will let you discover them on this well-done website : 
https://www.datacamp.com/community/tutorials/sets-in-python
'''
Comment

PREVIOUS NEXT
Code Example
Python :: How to Pass Additional Context into a Class Based View in django 
Python :: beautifulsoup find text inside tag 
Python :: run python version from terminal 
Python :: discord.py events 
Python :: arrays in python 
Python :: change column values based on another column pandas 
Python :: create empty numpy array 
Python :: set default formatter for python vscode 
Python :: python check if string or list 
Python :: call matlab function from python 
Python :: how to run a command in command prompt using python 
Python :: tuple in python 3 
Python :: convert excel to pdf python 
Python :: transpose of a matrix in python numpy 
Python :: select list of columns pandas 
Python :: python typing list of specific values 
Python :: django model inheritance 
Python :: how to end a while loop python 
Python :: lemmatization in nlp 
Python :: how to calculate log 10 in python 
Python :: values django 
Python :: formatted string in python 
Python :: how to find missing item in a list 
Python :: pandas count occurrences of certain value in row 
Python :: scikit learn library in python 
Python :: disable sns plot python 
Python :: Setting up WingIDE to debug Flask projects 
Python :: numpy iterate over rows with index 
Python :: list all placeholders python pptx 
Python :: pandas turn column of list into binary 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =