summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-05-04 23:30:27 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-05-04 23:30:27 +0000
commitab2f5720d8f396e05c87f31544846c8ab07be3fd (patch)
tree6613dca58a949342bdc7a73d14da8599936451b5
parenta005aa6910a6a9e1c22707d036c280a88e076b00 (diff)
Sat, May 4, 2024, 4:30 PM -07:00
-rw-r--r--wk6/pset/sentimental-readability/readability.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/wk6/pset/sentimental-readability/readability.py b/wk6/pset/sentimental-readability/readability.py
index 16750f5..299dbeb 100644
--- a/wk6/pset/sentimental-readability/readability.py
+++ b/wk6/pset/sentimental-readability/readability.py
@@ -22,4 +22,14 @@ for i in range(len(text)):
elif 96 < j and j < 123:
l += 1
-print(s, w, l, c)
+L = l / w * 100
+S = s / w * 100
+index = 0.0588 * L - 0.296 * S - 15.8
+if index < 1:
+ print("Before Grade 1")
+else:
+ ans = round(index)
+ if ans >= 16:
+ print("Grade 16+")
+ else:
+ print("Grade", ans)