We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 264bad4 commit cd9c168Copy full SHA for cd9c168
My-solutions/100 python exercises - ex14.py
@@ -1 +1,31 @@
1
-ze
+# Question 14
2
+# Level 2
3
+#
4
+# Question:
5
+# Write a program that accepts a sentence
6
+# and calculate the number of upper case letters and lower case letters.
7
+
8
+# Suppose the following input is supplied to the program:
9
+# Hello world!
10
+# Then, the output should be:
11
+# UPPER CASE 1
12
+# LOWER CASE 9
13
14
+import re
15
16
+test_string = "Hello World! WORLD And whatever the hell that MEANS"
17
18
+split = ''.join(re.split(r'\W+', test_string))
19
20
+upper = 0
21
+lower = 0
22
23
+for p in split:
24
+ if p.isupper():
25
+ upper += 1
26
+ elif p.islower():
27
+ lower += 1
28
29
30
+print upper
31
+print lower
0 commit comments