Question: 1.Write a function is_key() which accepts a dictionary d and a key k as parameters. The function is_key() returns True if k (potentially a string,

1.Write a function is_key() which accepts a dictionary d and a key k as parameters. The function is_key() returns True if k (potentially a string, int, or float) appears as a key in dictionary d. Otherwise, False.

2. Write a function is_value() which accepts a dictionary d and a value v as parameters. The function is_value() returns True if v (potentially a string, int, or float) appears as a value in dictionary d. Otherwise, False.

3. Consider the following dictionary eng2fr, which displays english to french translations for numeric values:

eng2fr = {'one' : 'un', 'two' : 'deux', 'three' : '?', 'four' : '?', 'five' : '?'}

Write a function get_translations() which loops through eng2fr and if a '?' value is detected, prompts the user to provide a translation and updates the value with user input. Once the dictionary is completely updated, get_translations() should thank the user and print the key-value pairs for each of the translations he/she provided.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!