Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8 . Implement crossout Read the specification of the function crossout in the module funcs. This function is very similar to the one of the

8. Implement crossout
Read the specification of the function crossout in the module funcs. This function is very similar to the one of the same name from Exercise 1. The only difference is that this function modifies the original list and does not return anything. Look at the test cases in tests.py if you are unsure about how it works.
Remember that you should never modify the loop-sequence in a for-loop. So your implementation should either loop over something else (positions) or use a while-loop. Also: you will need to remove rows and columns by their index numbers for this function. What list methods can be used for this? Refer to the list methods documentation page, linked from the Calling List Methods video in Module Three to review your options.
When you have implemented the function, test your answer with the test script before moving on to the next function.
def crossout(table,row,col):
"""
Modifies the table to remove the given row and column.
Examples:
If a =[[1,3,5],[6,2,7],[5,8,4]], crossout(a,1,2) changes a to [[1,3],[5,8]]
If a =[[1,3,5],[6,2,7],[5,8,4]], crossout(a,0,0) changes a to [[2,7],[8,4]]
If a =[[1,3],[6,2]], crossout(a,0,0) changes a to [[2]]
If a =[[6]], crossout(a,0,0) changes a to []
Parameter table: the nested list to modify
Precondition: table is a table of numbers. In other words,
(1) table is a nested 2D list in row-major order,
(2) each row contains only numbers, and
(3) each row is the same length.
Parameter row: the row to remove
Precondition: row is an index (int) for a row of table
Parameter col: the colummn to remove
Precondition: col is an index (int) for a column of table
"""

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions