| 20 | # does it count only alphabets or numerics too? |
| 21 | # ? what about other characters? |
| 22 | class Counter: |
| 23 | def __init__(self, text: str) -> None: |
| 24 | self.text = text |
| 25 | # Define the initial count of the lower and upper case. |
| 26 | self.count_lower = 0 |
| 27 | self.count_upper = 0 |
| 28 | self.compute() |
| 29 | |
| 30 | def compute(self) -> None: |
| 31 | for char in self.text: |
| 32 | if char.islower(): |
| 33 | self.count_lower += 1 |
| 34 | elif char.isupper(): |
| 35 | self.count_upper += 1 |
| 36 | |
| 37 | def get_total_lower(self) -> int: |
| 38 | return self.count_lower |
| 39 | |
| 40 | def get_total_upper(self) -> int: |
| 41 | return self.count_upper |
| 42 | |
| 43 | def get_total_chars(self) -> int: |
| 44 | return self.count_lower + self.count_upper |