Python Please Recap of two-dimensional arrays and their numpy implementation ** uploaded image ^ 1) In this problem, implement a TwoDArray class that is meant to mimic (some of) the functionality of a two-dimensional numpy array. DO NOT use numpy at any point. 1A) Give the class an __init__ method Make sure that the variable array is a valid input. This means you should a) Make sure that array is a list of lists. and b) Make sure that each of the inner lists has the same length. You do not need to check for anything else. If these conditions are not met you should raise the appropriate error(s). It is up for you to decide if you should raise a TypeError, KeyError, IndexError, ValueError, ZeroDivisionError, etc. When raising the error, you should also give an informative error message. With actual numpy arrays, all numbers are required to be the same datatype. You don't have to worry about that here. You can also assume that all numbers are ints or floats so you only have to worry about checking that the variable array is a list of lists.
Python Please
Recap of two-dimensional arrays and their numpy implementation
** uploaded image ^
1) In this problem, implement a TwoDArray class that is meant to mimic (some of) the functionality of a two-dimensional numpy array. DO NOT use numpy at any point.
1A) Give the class an __init__ method
Make sure that the variable array is a valid input. This means you should
a) Make sure that array is a list of lists. and b) Make sure that each of the inner lists has the same length. You do not need to check for anything else.
If these conditions are not met you should raise the appropriate error(s). It is up for you to decide if you should raise a TypeError, KeyError, IndexError, ValueError, ZeroDivisionError, etc. When raising the error, you should also give an informative error message.
With actual numpy arrays, all numbers are required to be the same datatype. You don't have to worry about that here. You can also assume that all numbers are ints or floats so you only have to worry about checking that the variable array is a list of lists.
1A)
def __init__(self, array):
self.array = array
*** What would be the rest of the code?
Step by step
Solved in 3 steps with 1 images