Question: # Question 3: # Modify the function such that it works according to the description below: # # This function assumes dictX is a dictionary
| # Question 3: | |
| # Modify the function such that it works according to the description below: | |
| # | |
| # This function assumes dictX is a dictionary with the following structure: | |
| # the key is always a string and the value is always an int. Here is a | |
| # sample dictionary: {'john': 93, 'jane':87, 'kramer': 53} and it has 3 entries. | |
| # | |
| # Each key-value pair in a dictionary is considered to be an entry. | |
| # | |
| # This function returns the number of entries where the key has one letter | |
| # in common with your 7 letter unique word AND the value has one digit | |
| # in common with your 5 digit number. The letters can be in either upper | |
| # or lower case. | |
| # | |
| # So, for Jane: | |
| # question3({'john': 93, 'jane':87, 'kramer': 53}) | |
| # should return 2 (the first and third entry matches) | |
| # | |
| # question3({'ann': 93, 'pat':87, 'kramer': 987}) | |
| # should return 0 (no entry matches conditions) | |
| def question3(dictX): | |
| return 0
# Do not use python lambdas # Do not use maps/filters #Do not import any other libraries - not even built-in ones, such as math # Change this to your specific 7 letter unique word MY_WORD = 'ORCHIDS' # Change this to your specific 5 digit unique number MY_NUM = 12345 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
