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 250508f commit 6fa0295Copy full SHA for 6fa0295
exercises/33-number-of-uppercase/solution.hide.py
@@ -1,11 +1,14 @@
1
-s = raw_input()
2
-d={"UPPER CASE":0, "LOWER CASE":0}
3
-for c in s:
4
- if c.isupper():
5
- d["UPPER CASE"]+=1
6
- elif c.islower():
7
- d["LOWER CASE"]+=1
8
- else:
9
- pass
10
-print "UPPER CASE", d["UPPER CASE"]
11
-print "LOWER CASE", d["LOWER CASE"]
+# Your code here
+def number_of_uppercase(string):
+ counts = {"UPPERCASE": 0, "LOWERCASE": 0}
+ for char in string:
+ if char.isupper():
+ counts["UPPERCASE"] += 1
+ elif char.islower():
+ counts["LOWERCASE"] += 1
+ else:
+ pass
+
12
+ return f"UPPERCASE {counts['UPPERCASE']} LOWERCASE {counts['LOWERCASE']}"
13
14
+print(number_of_uppercase("Hello world!"))
0 commit comments