From 602aab6c6e8b2c97fb64e486d0cf9e95be072050 Mon Sep 17 00:00:00 2001 From: Mor Bitton <57069656+morbitton@users.noreply.github.com> Date: Tue, 3 Dec 2019 16:54:07 +0200 Subject: [PATCH 1/4] Python Hw --- HW python.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 HW python.py diff --git a/HW python.py b/HW python.py new file mode 100644 index 0000000..ed238bd --- /dev/null +++ b/HW python.py @@ -0,0 +1,16 @@ +#my code: + +with open('text.txt') as file: + List=file.read().split() + wordDict={} + for word in List: + if word in wordDict: + wordDict[word]+=1 + else: + wordDict[word]=1 + + print(f' the most recurring word in that file: {max(wordDict, key=wordDict.get)}') + print(f'Appears {wordDict[max(wordDict,key=wordDict.get)]} times') + + + From b0dc4db59bf381ecab416b4187276485d443a3e5 Mon Sep 17 00:00:00 2001 From: Mor Bitton <57069656+morbitton@users.noreply.github.com> Date: Tue, 3 Dec 2019 16:55:16 +0200 Subject: [PATCH 2/4] text file --- text.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 text.txt diff --git a/text.txt b/text.txt new file mode 100644 index 0000000..b520b34 --- /dev/null +++ b/text.txt @@ -0,0 +1,10 @@ +Hello world +my name is mor + +Hello world +its my first program i write in python + +i do now homework at python +i use at python version python 3.6 + +python From 7dc2be20371b2194781855523775c5ee1d7619a3 Mon Sep 17 00:00:00 2001 From: mor Date: Tue, 3 Dec 2019 23:43:31 +0200 Subject: [PATCH 3/4] homework python --- HW python.py => Hwpython.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename HW python.py => Hwpython.py (100%) diff --git a/HW python.py b/Hwpython.py similarity index 100% rename from HW python.py rename to Hwpython.py From 441f2132242094d0c7ece4e54e5efaafc1d0a0d8 Mon Sep 17 00:00:00 2001 From: mor Date: Wed, 4 Dec 2019 00:36:16 +0200 Subject: [PATCH 4/4] fix homework python --- Hwpython.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Hwpython.py b/Hwpython.py index ed238bd..2d951bb 100644 --- a/Hwpython.py +++ b/Hwpython.py @@ -1,13 +1,13 @@ #my code: -with open('text.txt') as file: - List=file.read().split() - wordDict={} +with open('text.txt', 'r') as file: + f_read=file.read().split() + word_counter={} for word in List: if word in wordDict: - wordDict[word]+=1 + word_counter[word]+=1 else: - wordDict[word]=1 + word_counter[word]=1 print(f' the most recurring word in that file: {max(wordDict, key=wordDict.get)}') print(f'Appears {wordDict[max(wordDict,key=wordDict.get)]} times')