I have this code:
def main():
test_str = input('Enter word')
def count_dict(mystring):
d = {}
for w in mystring:
d[w] = mystring.count(w)
for k in sorted(d):
print(k + ' : ' + str(d[k]))
mystring = test_str
count_dict(mystring)
if __name__ == '__main__':
main()
and my output is like this:
Enter word: test
Output:
e : 1
s : 1
t : 2
Now the question is how can I add a '
to make it look like this:
'e' : 1
's' : 1
't' : 2