Example HTML page

P-Assignment 13: Dictionaries

Hi,

  1. Write a “Python” script to store ‘4’ key-value pairs in to a dictionary.
  2. Write a “Python” script to read ‘4’ key-value pairs from the user and store it in to the dictionary.
  3. Write a “Python” script to sort the dictionary on the basis of keys.
  4. Write a “Python” script to sort the dictionary on the basis of values of the corresponding keys.
  5. Write a “Python” script to read two lists from the user. Create a dictionary from these two lists by taking the elements from the first list as keys, and take the elements in the second list as values.
  6. Write a “Python” script to read two tuples from the user. Create a dictionary from these two tuples by taking the elements from the first tuple as keys, and take the elements in the second tuple as values.
  7. Write a “Python” script to concatenate the two dictionaries in to one dictionary.
  8. Write a “Python” script to print the sum of all values in a dictionary.
  9. Write any “4” possible ways of creating a dictionary with ‘3’ key-value pairs.
  10. Write a “Python” script remove the key-value pair in a dictionary by taking input from the user.
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest