diff --git a/HW4RonBitonPFNEW.py b/HW4RonBitonPFNEW.py new file mode 100644 index 0000000..586f5a2 --- /dev/null +++ b/HW4RonBitonPFNEW.py @@ -0,0 +1,11 @@ + + +file_song =open("song.txt","r") +data=file_song.read().split() +dict = {} +for i in data: + if i in dict: + dict[i] = dict[i] + 1 + else: + dict[i] = 1 +print(f'the word that appears most is: {max(dict, key=dict.get)}, And it appears {dict[max(dict, key=dict.get)]} times') \ No newline at end of file diff --git a/song.txt b/song.txt new file mode 100644 index 0000000..21bb24d --- /dev/null +++ b/song.txt @@ -0,0 +1,16 @@ + +Well I heard there was a secret chord +That David played and it pleased the Lord +But you don't really care for music, do you? +Well it goes like this: +The fourth, the fifth, the minor fall and the major lift +The baffled king composing Hallelujah + +Hallelujah, Hallelujah, Hallelujah, Hallelujah... + +Well your faith was strong but you needed proof +You saw her bathing on the roof +Her beauty and the moonlight overthrew ya +She tied you toher kitchen chair +She broke your throne and she cut your hair +And from your lips she drew the Hallelujah