• what do i do wrong

Question related to mission How to Find Friends

 

friends help understand where i need to put thr "return False" im getting carzy

just copy and run


check_connection1=( ("dr101-mr99", "mr99-out00", "dr101-out00", "scout1-scout2", "scout3-scout1", "scout1-scout4", "scout4-sscout", "sscout-super"), "scout2", "scout3")

def lenson(network,first): sumi=0 for i in [item for item in network if first in item ]: sumi+=1 return sumi

def myson(first): print(first) if first.find('-'): return (first.split('-',1)[1]) else : return (first)

def check_connection(network,first,second):

for i in  [item for item in network if first in item ] :
    #print (i,len([item for item in network if first in item ]))
    print ([item for item in network if first in item ])

    if i.split('-',1)[0]==second or i.split('-',1)[1]==second :
        print (True)
        return(True)
    elif lenson(network,myson(i))>1 and i.split('-',1)[0]==first :
        check_connection(network,i.split('-',1)[1],second)





print (False," exit")

print(checkconnection(checkconnection1[0],"scout1","super"))