From dd70842c194e5d2df2306434d7a409514f40a004 Mon Sep 17 00:00:00 2001 From: Sourcery AI Date: Thu, 21 Oct 2021 15:33:08 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- inPython.py | 7 ++----- withRust.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/inPython.py b/inPython.py index c2d4b19..9a047bc 100644 --- a/inPython.py +++ b/inPython.py @@ -2,10 +2,7 @@ def shortLong(string): split = string.split() split = [i for i in split if (i != "the") & (i != "a")] - l = 0 - for i in split: - if len(i) > 8: - l += 1 + l = sum(len(i) > 8 for i in split) return l / len(split) @@ -13,7 +10,7 @@ def shortLong(string): example = "" with open("formalSentences.txt",encoding="utf8") as f: for line in f: - example = example + line + example += line #PRINT RESULT print("Pure Python: ") diff --git a/withRust.py b/withRust.py index f201f6c..41b559a 100644 --- a/withRust.py +++ b/withRust.py @@ -12,7 +12,7 @@ with open("formalSentences.txt",encoding="utf8") as f: for line in f: - example = example + line + example += line #PRINT RESULT print("With Rust: ")