Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Dec 10 19:37:46 2020
- @author: randr
- """
- def treasure_hunt(initial_city, clues_list, dictionary, secret_m = []):
- #base case
- if clues_list == []:
- return secret_m
- dict_key = initial_city + clues_list.pop(0)
- if dict_key in dictionary.keys():
- if len(dictionary[dict_key]) > 1:
- sublist = ['']*len(dictionary[dict_key])
- for elem in dictionary[dict_key]:
- sublist[dictionary[dict_key].index(elem)] += ' ' + dictionary[dict_key][0][1]
- return treasure_hunt(dictionary[dict_key][0][0], clues_list, dictionary, secret_m)
- return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement