28 lines
513 B
Python
28 lines
513 B
Python
|
# 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
|
|||
|
# it’ll 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()
|