Create a Set and Print :
thisset = {"apple", "banana", "cherry"}
print(thisset)
Output :
{'apple', 'banana', 'cherry'}
Set Ignores Duplicates :
thisset = {"apple", "banana", "cherry", "apple"}
print(thisset)
Output :
{'apple', 'banana', 'cherry'}
Length of a Set :
thisset = {"apple", "banana", "cherry"}
print(len(thisset))
Output :
3
Set Items with Different Data Types :
set1 = {"apple", "banana", "cherry"}
set2 = {1, 5, 7, 9, 3}
set3 = {True, False, False}
print(set1)
print(set2)
print(set3)
Output :
{'apple', 'banana', 'cherry'}
{1, 3, 5, 7, 9}
{False, True}
Set With Mixed Data Types :
set1 = {"abc", 34, True, 40, "male"}
print(set1)
Output :
{'abc', 34, True, 40, 'male'}