-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPy_Exercise-14.py
More file actions
31 lines (26 loc) · 809 Bytes
/
Py_Exercise-14.py
File metadata and controls
31 lines (26 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -------------------------------------------------------------------------
# Author: Quang Tran
# Date: May 15th, 2019
# -------------------------------------------------------------------------
"""
Question:
Write a program that accepts a sentence and calculate the number of upper case letters and lower case letters.
Suppose the following input is supplied to the program:
Hello world!
Then, the output should be:
UPPER CASE 1
LOWER CASE 9
"""
user_input = input("Please enter something: ")
upper_counter = 0
lower_counter = 0
for e in user_input:
if not e.isspace():
if e.isupper():
upper_counter += 1
elif e.islower():
lower_counter += 1
else:
pass
print("Upper: {}".format(upper_counter))
print("Lower: {}".format(lower_counter))