Sets - 3.2.7

##Unordered, unchanged, indexed, no duplicate values

myset = {"apple", "banana", "cherry"}
# Sets are abstractions because they provide an unordered collection of unique elements, without exposing the underlying mechanisms

print("\nThe whole set is:")
print(myset)

print("\nThe value of the index 0 is:")
for i in myset:
    print(i)

print("\nTo add an orange:")
myset.add("orange")
for i in myset:
    print(i)

print("\nTo remove a banana:")
myset.remove("banana")
for i in myset:
    print(i)
The whole set is:
{'banana', 'apple', 'cherry'}

The value of the index 0 is:
banana
apple
cherry

To add an orange:
banana
orange
apple
cherry

To remove a banana:
orange
apple
cherry

Javascript

var myset = new Set(["apple", "banana", "cherry"]);

console.log(Array.from(myset).join(", "))
console.log(Array.from(myset).join(", "))

myset.add("orange");
console.log(Array.from(myset).join(", "))

myset.delete("banana");
console.log(Array.from(myset).join(", "))
  Cell In[1], line 1
    var myset = new Set(["apple", "banana", "cherry"]);
        ^
SyntaxError: invalid syntax