Advertisement
Andry41

Untitled

Dec 12th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Dec 10 19:37:46 2020
  4.  
  5. @author: randr
  6. """
  7.  
  8. def treasure_hunt(initial_city, clues_list, dictionary, secret_m = []):
  9. #base case
  10. if clues_list == []:
  11. return secret_m
  12.  
  13.  
  14. dict_key = initial_city + clues_list.pop(0)
  15.  
  16.  
  17. if dict_key in dictionary.keys():
  18. if len(dictionary[dict_key]) > 1:
  19. sublist = ['']*len(dictionary[dict_key])
  20. for elem in dictionary[dict_key]:
  21.  
  22. sublist[dictionary[dict_key].index(elem)] += ' ' + dictionary[dict_key][0][1]
  23.  
  24. return treasure_hunt(dictionary[dict_key][0][0], clues_list, dictionary, secret_m)
  25.  
  26.  
  27. return None
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement