How to Find Friends How to Find Friends
Simple
ZH-HANS UK RU JA HU FR ES EL English

Sophia's drones are not soulless and stupid drones; they can make and have friends. In fact, they already are working for the their own social network just for drones! Sophia has received the data about the connections between drones and she wants to know more about relations between them.

We have an array of straight connections between drones. Each connection is represented as a string with two names of friends separated by hyphen. For example: "dr101-mr99" means what the... and are friends. Your should write a function that allow determine more complex connection between drones. You are given two names also. Try to determine if they are related through common bonds by any depth. For example: if two drones have a common friends or friends who have common friends and so on.

network network

Let's look at examples:
and have the common friend so they are related. and are related through , and . But and are not related.

Three arguments: Information about friends as a tuple of strings; first name as a string; second name as a string.

Are these drones related or not as a boolean.

check_connection(
    ("dr101-mr99", "mr99-out00", "dr101-out00", "scout1-scout2",
     "scout3-scout1", "scout1-scout4", "scout4-sscout", "sscout-super"),
    "scout2", "scout3") == True
check_connection(
    ("dr101-mr99", "mr99-out00", "dr101-out00", "scout1-scout2",
     "scout3-scout1", "scout1-scout4", "scout4-sscout", "sscout-super"),
    "dr101", "sscout") == False
    

This concept will help you find not too obvious connections with the building of bond networks. And how to work social networks.

len(network) ≤ 45
if in , then not in
3 ≤ len(drone_name) ≤ 6
and in .

You should be an authorized user in order to see the full description and start solving this mission.