List comprehension, check if item is unique
You can use set and set comprehension: {hobby for name, hobbies in input.items() for hobby in hobbies} As m.wasowski mentioned, we don’t use the name here, so we can use item.values() instead: {hobby for hobbies in input.values() for hobby in hobbies} If you really need a list as the result, you can do this (but … Read more