summary refs log tree commit diff stats
path: root/python/code/2/6.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/code/2/6.py')
-rw-r--r--python/code/2/6.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/code/2/6.py b/python/code/2/6.py
new file mode 100644
index 0000000..8013ae4
--- /dev/null
+++ b/python/code/2/6.py
@@ -0,0 +1,11 @@
+line = input('Enter a string: ')
+uppercase_count, lowercase_count, digit_count = 0, 0, 0
+for c in line:
+    if c.isupper(): uppercase_count += 1
+    elif c.islower(): lowercase_count += 1
+    elif c.isdigit(): digit_count += 1
+
+print('Number of')
+print('  Uppercase characters:', uppercase_count)
+print('  Lowercase characters:', lowercase_count)
+print('  Digits:', digit_count)