I'm working with python and I was wondering what would be the difference between a set () () and a tuple (). I know that both are delimited with '()'.
But I tried to assign a set attribute to a tuple, that is:
THIS IS MY SET: (OR WHAT I THOUGHT IT WAS ...)
basket = ('apple', 'orange', 'banana', 'pineapple', 'pear')
I GIVE THE FOLLOWING COMMAND:
basket.discard(2))
print (basket)
When I ran the program gave an error ... It said:
* line 16: basket.discard (2)
AttributeError: 'tuple' object has no attribute 'discard' *
Why did you consider my set to be a tuple?