Answers for "list vs set in python"

2

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 has to be unique.
It is better to use sets compared to lists as much as possible,
because of its speed to retrieve data and space memory economy.
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
'''
Posted by: Guest on June-12-2021
2

List vs Set

List > Ordered and Indexed Collection, May contain duplicates
Set > Collection of Unique values, not ordered, no indexing
Posted by: Guest on November-28-2020
4

set vs list

Set is unordered
List is ordered collection, 
List allow duplicate elements
Set does not allow duplicates.
List can have multiple null elements
Set will allow only one null element.
The List can contain duplicate elements
Set includes unique items.
Posted by: Guest on December-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language