scratch/2021-07-05/michael/main.py

28 lines
513 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# hey bro can I ask for a little help?
# I want to figure out a script or sumn that can count and separate the characters in a string of text
# like if I enter in dushdhaosbvdiebwb
# itll tell me how many of which character is in it
# key, value
# string, integer
# "a": 1
#
def main():
freq = {}
str = input("Enter Text: ")
for char in str:
if char in freq:
freq[char] += 1
else:
freq[char] = 1
print(freq)
if __name__ == "__main__":
main()