Question
This regards dictionaries. My function name is clist which is supposed to be list of list. It gets random numbers (range 1 to 100) and
This regards dictionaries. My function name is clist which is supposed to be list of list. It gets random numbers (range 1 to 100) and will add, and and fill a 10 x 10 2d list. Then it will return it. It will have arguments as input for row and column size.
The next function will also take argument and it is called is pListthat will print a list in row column fashion. Separating the columns with tab tab character.
The 3rd function is vList that will iterate through a 2D list examining each value. If the value is an odd number,it will append it to a dictionary as the key and use the word 'odd' as the value. If the number is even append the number to the dictionary as the key and use the word 'even' as the value.
The keys will be unique. We do not store the value. I need to use the in operator and the keys function of the dictionary.
Keys in a dictionary have to be unique for this reason the dictionary should not have duplicate valued keys. What this meansis that I need to check the dictionary to make sure I have not already stored the value. I will use the operator and the keys function that is part of the dictionary.
After the 3 functions , print the dictionary, use print function only in the function plist. There are no inputs within the functions and no global variables.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started