Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert list to set python

names = ['Barry', 'Alice', 'Bob', 'Bob']

unique_names = set(names)
# Result:
# {'Alice', 'Barry', 'Bob'}
Comment

python set to list

pokemon_set = set(['Pikachu', 'Bulbasaur', 'Koffing' , 'Spearow', 'Vulpix'])
print(pokemon_set)
pokemon_list = list(pokemon_set)
print(pokemon_list)
Comment

python list to set

 
listOfStudents=['Mohan','John','Ramesh','Mohan','John']
print("List of Students:",listOfStudents)
uniqueNames=set(listOfStudents)
print("Set of uniqueNames:",uniqueNames)
 
listOfMarks=[8,7,6,7,8,8,7,6,7,8,9]
print("List of Makrs:",listOfMarks)
setOfMarks=set(listOfMarks)
print("Set of marks:",setOfMarks)
 
Comment

PREVIOUS NEXT
Code Example
Python :: WSGIPassAuthorization on 
Python :: position text in a box matplotlib 
Python :: pip ne marche pas 
Python :: django count all objects 
Python :: python custom class indexing 
Python :: pyqt5 spin box change value trigger 
Python :: python all option 
Python :: pyton como identificar se é numero 
Python :: how to split a dataframe into train and test 
Python :: what is cpython 
Python :: how to check for updates from github in python 
Python :: how to sort subset of rows in pandas df 
Python :: python chunk text 
Python :: find the median of input number in a list and print 
Python :: menor valor lista python 
Python :: sum of list of numbers 
Python :: random list 
Python :: How to build a Least Recently Used (LRU) cache, in Python? 
Python :: numpy variance 
Python :: filter function in python 
Python :: Python get the name of the song that is playing 
Python :: quotation marks n string 
Python :: Python NumPy transpose Function Syntax 
Python :: get last x elements of list python 
Python :: iterate over rows in numpy matrix python 
Python :: 2d array python 
Python :: color module python 
Python :: how to create multiple file in python using for loop. 
Python :: create an array filled with 0 
Python :: python using list as dictionary key 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =