Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- dirmap = {"north": "n", "northeast": "ne", "east": "e", "southeast": "se", "south": "s", "southwest": "sw", "west": "w", "northwest": "nw", "down": "d", "up": "u"}
- def get_paths():
- with open("paths.txt", "r") as f:
- lines = f.readlines()
- dir_l = [dirmap[l.split('"')[1]] for l in lines if l[:8] == "The word"]
- print("::".join(dir_l))
- print("----- number of steps:", len(dir_l))
- if __name__ == '__main__':
- get_paths()
Advertisement
Add Comment
Please, Sign In to add comment