From c2ed3ce906ea1fd8850ada39848990725f2706ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jurgo?= Date: Thu, 3 Nov 2016 08:42:31 +0100 Subject: [PATCH] Dictionary prototype --- dictFunctions.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 dictFunctions.py diff --git a/dictFunctions.py b/dictFunctions.py new file mode 100644 index 0000000..e0eeef8 --- /dev/null +++ b/dictFunctions.py @@ -0,0 +1,50 @@ +monty = ["left", "chess", "back", "load"] + + +def getWordsSendDict(myList = []): + + output = {} + output['Movement'] = checkMovement(myList) + output['Direction'] = checkDirection(myList) + output['Action'] = checkAction(myList) + print(output) + return output + +def checkMovement(myList = [], *args): + file = open("movement.txt", 'r') + content = file.readlines() + content = [x.strip('\n') for x in content] + for i in content: + for j in myList: + if j == i: + file.close() + return i + file.close() + +def checkDirection(myList = [], *args): + file = open("directions.txt", 'r') + content = file.readlines() + content = [x.strip('\n') for x in content] + for i in content: + for j in myList: + if j == i: + file.close() + return i + file.close() + +def checkAction(myList = [], *args): + file = open("actions.txt", 'r') + content = file.readlines() + content = [x.strip('\n') for x in content] + for i in content: + for j in myList: + if j == i: + file.close() + return i + file.close() + + +def saveDict() + + +getWordsSendDict(monty) \ No newline at end of file