Skip to content

Commit 6fa0295

Browse files
authored
Update solution.hide.py
1 parent 250508f commit 6fa0295

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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"]
1+
# Your code here
2+
def number_of_uppercase(string):
3+
counts = {"UPPERCASE": 0, "LOWERCASE": 0}
4+
for char in string:
5+
if char.isupper():
6+
counts["UPPERCASE"] += 1
7+
elif char.islower():
8+
counts["LOWERCASE"] += 1
9+
else:
10+
pass
11+
12+
return f"UPPERCASE {counts['UPPERCASE']} LOWERCASE {counts['LOWERCASE']}"
13+
14+
print(number_of_uppercase("Hello world!"))

0 commit comments

Comments
 (0)