diff --git a/Challenge.py b/Challenge.py new file mode 100644 index 0000000..63941cf --- /dev/null +++ b/Challenge.py @@ -0,0 +1,21 @@ + +f = open("text.txt", "r") +if f.mode == 'r': + contents = f.read().split() + print(contents) + +countDict={} + +for word in contents: + if word in countDict: + countDict[word]=countDict[word]+1 + else: + countDict[word] =1 + +max= max(countDict, key=countDict.get) +print("The word " +max + " is the most recurring word in that file") + + + + +f.close() \ No newline at end of file