English101
0
Q:

orderd set in python

pip install ordered-set
from ordered_set import OrderedSet
letters = OrderedSet('abracadabra')
print(letters) # {'a', 'b', 'r', 'c', 'd'} 
1
# Creating a Set with  
# a List of Numbers 
# (Having duplicate values) 
set1 = set([1, 2, 4, 4, 3, 3, 3, 6, 5]) 
print("\nSet with the use of Numbers: ") 
print(set1) 
  
# Creating a Set with  
# a mixed type of values 
# (Having numbers and strings) 
set1 = set([1, 2, 'Geeks', 4, 'For', 6, 'Geeks']) 
print("\nSet with the use of Mixed Values") 
print(set1) 
-1

New to Communities?

Join the community