Alphabet Spam

This commit is contained in:
2023-07-02 20:48:06 +02:00
parent 3f3718d093
commit 523d14fefb

21
alphabetspam.py Normal file
View File

@@ -0,0 +1,21 @@
s = input()
uppercase = 0
lowercase = 0
whitespace = 0
specials = 0
for c in s:
if c == "_":
whitespace += 1
elif 65 <= ord(c) <= 90:
uppercase += 1
elif 97 <= ord(c) <= 122:
lowercase += 1
else:
specials += 1
total = len(s)
print(f"{whitespace/total:.10f}")
print(f"{lowercase/total:.10f}")
print(f"{uppercase/total:.10f}")
print(f"{specials/total:.10f}")