0
Python разве не должен быть вывод ??? почему нет вывода print(" is а mango seller!")
graph = {} graph["you"] = ["alice", "ЬоЬ", "claire"] graph["bob"] = ["anuj", ] graph["alice"] = ["peggy"] graph["claire"] = ["thom", "jonny"] graph["anuj"] = [] graph["peggy"] = [] graph["thom"] = [] graph["jonny"] = [] from collections import deque def search(name): search_queue = deque() search_queue += graph[name] searched = [] while search_queue: person = search_queue.popleft() if not person in searched: if person == "bob": print(" is а mango seller!") return True else: search_queue += graph[person] searched.append(person) return False
1 Answer
+ 1
You never call search.
Вы никогда не звоните в поиск.