we add elements to a set using the add() method. Again as discussed there is no specific index attached to the newly added element.
by using our previous data let's add another element in the existing set.
players = set(['Madueke','Reece James','Cole Palmer','Raheem Sterling','Levi Colwil','Thiago Silva',
'Mudryk','cucurella','Nkunku Christopher'])
players.add("Enzo Fernandez")
print(players)
output:
When the above code is executed, it produces the following result
'Mudryk', 'Levi Colwil', 'Thiago Silva', 'Nkunku Christopher', 'Raheem Sterling', 'Reece James', 'Madueke', 'Enzo Fernandez', 'cucurella', 'Cole Palmer'}
Top comments (0)