[SOLVED] What am I doing wrong - letter counter exercise in intermediate python
**This is the exercise:** Given a string as input, you need to output how many times each letter appears in the string. You decide to store the data in a dictionary, with the letters as the keys, and the corresponding counts as the values. Create a program to take a string as input and output a dictionary, which represents the letter count. Sample Input: hello Sample Output: {'h': 1, 'e': 1, 'l': 2, 'o': 1} **Here's my code:** text = input() dict = {} count = 0 for x in text: count += 1 dict[x] = count print(dict) But it's not counting how many times each letter appears, it's saying where in the string the last instance of each letter appears. How do I fix this? (Not looking for other solutions, I've already found some great ones - such as this https://code.sololearn.com/cZw2842qky59/?ref=app - just wanting to work through this approach for my own understanding.)