Hi Ginevra,
Sets require their items to be hashable. In Python only the immutable ones, such as strings, numbers, and tuples, are hashable. While lists and dictionaries are not hashable.
But notice that when you pass the set() an iterable, it builds a set out of the elements provided in the iterable. So when you pass set() a list, it creates a set containing the objects within the list, but if you pass a list of lists it's not going to work as you expect because it cannot build a set out of the elment list.
This is why Python complains in your case:
- you're trying to set a tuple (fine) but this tuple contains lists !
- also when you try to set the hole list_of is not the outer list to complain but the small ones inside of the tuples.
I'm pretty sure I didn't get your idea and why you need those tuples so maybe this is not gonna work for you but notice that Python wouldn't complain to set a tuple of strings.. so set(('vendita','diamanti','rubati','MILANO')) is going to work and even set([('vendita','diamanti','rubati','MILANO'), ('mata','hari','ha','CANCUN')]) will work.
Hope this helps :)