Question
Write a python function called createList that will fill, create, and return a 10 x 10 2d list (list of lists) with random numbers in
Write a python function called createList that will fill, create, and return a 10 x 10 2d list (list of lists) with random numbers in the range of 1 to 100. This function should take as an argument the row and column size. You are to have the list produce a 10 x 10 2d list but by passing the row and column size the function could create a list of any size. This function should return the list.
Write a function called printList that will print a list in row column fashion. You should separate each value in the column with a tab character. This function should take as an argument the list to print.
Write a function called labelValues that will iterate through a 2D list examining each value. If the value is an odd number 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.
NOTE:
Keys in a dictionary have to be unique for this reason the dictionary should not have duplicate valued keys. What this means to you is that you need to check the dictionary to make sure you have not already stored the value. You should use the in operator and the keys function that is part of the dictionary.
To test that you have a list of unique numbers that are labeled properly you should test your functions in this way:
createList
printList
labelValues
print out the dicitonary
What not to do
Using any of the following will drop your grade for this assignment by 70%
global variables
print in in any function other than printList
input in any function
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