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

28 lines
513 B
Python
Raw Normal View History

2021-07-07 01:48:49 +00:00
# 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()