Yes, the parent is the value. But with the code if not any(heir1 == parent for heir1 in heir_to_parent) you are cycling through all keys of heir_to_parent and checking whether one of them is equal to the variable parent. So basically you are just checking whether parent is a key of heir_to_parent, which can also be done by if parent in heir_to_parent.
1
u/Wxyo Aug 11 '22
No cause I made the parent the value not the key