dic = {'a': {1, 2, 3}, 'b': {5, 6, 7}}
print(dic['a'])
How can I get the printed result to exclude 1 (not to remove) to be:
{2,3}
dic = {'a': {1, 2, 3}, 'b': {5, 6, 7}}
print(dic['a'])
How can I get the printed result to exclude 1 (not to remove) to be:
{2,3}
You could subtract {1} from the inner set:
print(dic['a'] - {1})
{2, 3}
Or equivalently you can use difference:
print(dic['a'].difference({1}))
{2, 3}
You can learn more about the topic on sets — Unordered collections of unique elements