Follow pairs that have a direction
Predict the output · Medium · §4.6 A map of four containers
Who follows whom is written as (follower, followed) tuples and collected in a set. Predict the output without running the code.
Code
follows = {("dami", "yuna"), ("yuna", "dami"),
("dami", "yuna"), ("taeo", "dami")}
print(len(follows))
print(("yuna", "dami") in follows)
print(("dami", "taeo") in follows)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.