MCPcopy Create free account
hub / github.com/geekcomputers/Python / Counter

Class Counter

1 File handle/File handle text/counter.py:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class 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

Callers 2

lowercaseFunction · 0.90
lowercaseFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected