Update 3 - Poetic Analysis.py

This commit is contained in:
Lukas Baumann 2021-02-22 11:34:20 +01:00 committed by GitHub
parent 80e1239159
commit 665b8f3835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,7 @@
txt = input().split()
txt = input().lower().split()
while txt[-1] != "###":
txt += input().split()
amount = {}
for i in txt:
if i.lower() in amount:
amount[i.lower()] += 1
else:
amount[i.lower()] = 1
max = ["", 0]
for i in amount:
if amount[i] > max[1]:
max = [i, amount[i]]
print(max[0])
txt += input().lower().split()
m = [0]*len(txt)
for i in range(len(txt)):
m[i]=txt.count(txt[i])
print(txt[m.index(max(m))])