mirea-projects/First term/Algorithms/4/2.py

16 lines
328 B
Python
Raw Permalink Normal View History

2024-09-23 23:22:33 +00:00
def main(string: str) -> None:
some_dict = {}
for char in string:
if some_dict.get(char) is None:
some_dict[char] = 1
continue
some_dict[char] += 1
for key in some_dict.keys():
print(f"'{key}': {some_dict[key]}")
if __name__ == "__main__":
main("hello world")