9.7 Practice



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}


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:
  • If they enter "add" : Ask them to enter an item. Ask them to enter a price. The item should be the key, and the price should be the value in the dictionary
  • If they enter "delete" : Ask them which item they'd like to delete.
  • If they enter "clear" : Clear all the entries from the dictionary.
  • If they enter "q" : Display the final dictionary and end the program


Store words (keys) and definitions (values) in a dictionary in random order. Then, ask the user to input a word. If the word is in the dictionary, use it to display the definition. Otherwise, print out a message saying that the word is not there.
Display the entire dictionary at the end in the following format:
word1 : definition1 word2 : definition2 (etc)

Participation Grade

Warning! This can be challenging
A teacher is given a list of students. The number of occurrences of a student's name in the list is the number of times the student participated this week. If a student has 8 or more participations, they get an A. If a student has between 4 and 7 participations, they get a B. If a student has more than 0 but less than 4 participations, the student gets a C.
Make a dictionary with the keys as the student's name and the values as the corresponding student's letter grade. Print the dictionary.
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.