Question: Python 3.5 Write a program, dCount(lst,n) , which will take a 2-dimensional list which consists of a number (lst[i][0]) and string (lst[i][1]). The program will

Python 3.5

Write a program, dCount(lst,n), which will take a 2-dimensional list which consists of a number (lst[i][0]) and string (lst[i][1]). The program will read each element in the list and create a dictionary entry with the number as the key and the string as the value until the number equals n. When the number (lst[i][0]) equals n, the program PRINTS the dictionary and RETURNS the length of the dictionary. If lst is empty, the dictionary will be empty and the length returned will be 0. It is possible that the list will not contain n in which case it will process through to the end of the list and print the dictionary and return the length as described.

You are required to use a while loop and you must check (you are NOT required to use a try/except)

Python 3.5 Write a program, dCount(lst,n), which will take a 2-dimensional list

dCount (II a [40 b [10 40 'b', 3 'a' ount 10) dCount (II a' 3: 'b', 4 'a', 5: c', 6 'q' c' 11, 10) q' 11, 10)

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!