Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called createList that will fill, create, and return a 10 x 10 2d list (list of lists) with random numbers in the

Write a 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 funciton other than printList

input in any funciton

Your program output should resemble the following:

image text in transcribed

CAWINDOWSMsystem32 cmd.exe 96 48 90 97 70 31 75 31 11 52 22 30 98 86 28 77 28 66 41 81 67 10 25 57 62 79 97 75 46 52 93 38 19 34 33 17 15 43 56 43 32 52 77 10 11 91 58 48 38 100 99 30 63 36 29 81 96 22 19 53 10 13: odd 6: even 7: odd 8: even 10: even 11 odd 13 odd 15 odd 17 odd 19 odd 20 even 22 even 25 odd 28 even 29 odd 30 even 31 odd 32 even 33 odd 34 even 36 even 37 odd 38 even 40 even 41 odd 43 odd 44 even 45 odd 46 'e ven', 47 odd 48 even 52 even 53 odd 56 even 57 odd 58 'e Ven 62 even 63 odd 64 even 66 even 67 odd 70 even 71 odd 75 odd 77 odd 79 odd 80 even 81 odd 85 odd 86 'eve n 88 even 90 even 91 odd 93 odd 96 even 97 odd 98 'eve n 99 odd 100 even Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Describe the strategic training and development process.

Answered: 1 week ago

Question

10. Microsoft Corporation

Answered: 1 week ago