From f8bc73d72c6e38e0ddd4bf6efe44055fd8594c86 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 8 Jan 2023 12:22:30 +0000 Subject: [PATCH] Replace range(len(...)) with enumerate(...) --- app.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index c1ad668..94ede26 100644 --- a/app.py +++ b/app.py @@ -728,15 +728,15 @@ def warten(): # function for the wait function string = line.lower().replace(",", "").replace(".", "").split(" ") words.extend(iter(string)) - for i in range(len(words)): + for i, item in enumerate(words): count = 1 for j in range(i + 1, len(words)): - if words[i] == words[j]: + if item == words[j]: count = count + 1 if count > maxCount: maxCount = count - name_tot = words[i] + name_tot = item with open("rollen_log.txt", "r+") as fileTot: @@ -939,15 +939,15 @@ def wahl_stats(): string = line.lower().replace(",", "").replace(".", "").split(" ") words.extend(iter(string)) - for i in range(len(words)): + for i, item in enumerate(words): anzahl = 1 for j in range(i + 1, len(words)): - if words[i] == words[j]: + if item == words[j]: anzahl = anzahl + 1 if anzahl > maxCount: maxCount = anzahl - name_tot = words[i] + name_tot = item werwolf.schreibe_zuletzt_gestorben(name_tot) @@ -1086,15 +1086,15 @@ def wer_wahl_warten(): string = line.lower().replace(",", "").replace(".", "").split(" ") words.extend(iter(string)) - for i in range(len(words)): + for i, item in enumerate(words): count = 1 for j in range(i + 1, len(words)): - if words[i] == words[j]: + if item == words[j]: count = count + 1 if count > maxCount: maxCount = count - name_tot = words[i] + name_tot = item with open("rollen_log.txt", "r+") as fileTot: