1

I am new to python, When I am trying to add or update the String element in set it's behaving strangely.

dummySet={10,20,30}
type(dummySet)
<class 'set'>
dummySet.add('Adam')
{10, 20, 30, 'Adam'}#Here it is adding a whole word, when I do add operation.
dummySet.update('Eve')
{'E', 10, 'Adam', 20, 'e', 'v', 30}#It is adding all character as element in the set.

I had tried over the google also but havn't got the clear explanation on this.

Can any one explain why this is behaving or reason behind this.

cs95
  • 379,657
  • 97
  • 704
  • 746
SaviNuclear
  • 886
  • 1
  • 7
  • 19

0 Answers0