| 7 | |
| 8 | |
| 9 | class Counter: |
| 10 | def __init__(self, text: str) -> None: |
| 11 | self.text = text |
| 12 | |
| 13 | # Define the initial count of the lower and upper case. |
| 14 | self.count_lower = 0 |
| 15 | self.count_upper = 0 |
| 16 | self.count() |
| 17 | |
| 18 | def count(self) -> None: |
| 19 | for char in self.text: |
| 20 | if char.lower(): |
| 21 | self.count_lower += 1 |
| 22 | elif char.upper(): |
| 23 | self.count_upper += 1 |
| 24 | |
| 25 | return (self.count_lower, self.count_upper) |
| 26 | |
| 27 | def get_total_lower(self) -> int: |
| 28 | return self.count_lower |
| 29 | |
| 30 | def get_total_upper(self) -> int: |
| 31 | return self.count_upper |
| 32 | |
| 33 | def get_total(self) -> int: |
| 34 | return self.count_lower + self.count_upper |