Practice

Characters

Write a Python program to create a dictionary from a string where the keys are the characters and the values are the frequency of the characters.

Your program should ask the user to enter a string, convert it into the dictionary described above, and print the resulting dictionary.

NOTE: Using "collections.Counter" is not allowed for this problem.

Example output:

Enter a string:  hello244oh
{'h' : 2, 'e' : 1, 'l' : 2, 'o' : 2, '2' : 1, '4' : 2}

💻 Template code

✅ Solution code

Catalog

Write a program that asks the user whether they'd like to add, delete, or clear the entries in a store catalog.

After they perform some action, the program should display the updated dictionary in the following format:

item1 : price1
item2 : price2
(etc)

Keep asking them if they'd like to add, delete, or clear entries until they enter "q".

Possible actions:

💻 Template code

✅ Solution code