Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function that returns 2 dimensional array of zeros with its size specified in the function arguments. The two arguments should be name, explicitly,
Write a function that returns 2 dimensional array of zeros with its size specified in the function arguments. The two arguments should be name, explicitly, rows and cols as they will be used when calling the function. You can assume that the passed values for the rows and columns will be always greater than 0. Here, you'll write a function which: - is named generate_2d. - takes 2 arguments, named: rows for the rows number in the array and for the columns number. - returns: 2 dimensional array. You should use regular Python lists and you are not allowed to use NumPy for this question. 59]: \# Solution goes here 60]: res = generate_2d (2,3) assert res ==[[0,0,0],[0,0,0], NameError Traceback (most recent call last) Cell In [60], line 1 >1 res = generate 2d(2,3) 2 assert res ==[[0,0,0],[0,0,0], NameError: name 'generate_2d' is not defined 61]: res = generate_ 2d(5,2) assert res =[[0,0],,[0,0],,[0,0],,[0,0],,[0,0]
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