Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Dictionary - count characters
import json string1 = input('Enter your string: ').strip() unique_letters = set(string1) letters_occurrences = {} for letter in unique_letters: letters_occurrences[letter] = string1.count(letter) print() # newline # Pretty printing the dictionary print(json.dumps(letters_occurrences, indent=4))
run
|
edit
|
history
|
help
0
shuru15
Removing adjacent duplicates from string
gj4
shuru4
Python Monthly Calendar
try123
Quick sort
Insert a sequence of same numbers, unpacking
Doki Doki Study Club p.one
variables.py