Are we allowed to leverage code from previous labs in our programming assignments?

Hi team,

Can I copy code from previous labs such as the Cost Function Lab into my week 2 programming assignment? I understand the idea is not for us to memorize code but rather know how to implement it. I dont want to break any rule or fail to comply with the ethic code of the course.

Thanks in advance

Doing that should not be necessary. Each lab presents a specific method for you to implement.

Hi TMosh,

Sorry, my question may have not been very precise. What I mean is the following: in the assignment we’re required to populate the code for two functions, which have been explained during the course, and given my lack of previous knowledge, I do not know any other way to perform this rather than the one explained during the labs. For example, to compute the cost, I cannot think of any other way to do it that is not using the For loop presented during the labs and so my answer will be pretty similar to the one provided in the labs as there not many different ways to do this with my current Python knowledge - I know there are other loop structures but I am not familiar with them.

Thanks once again for your help.

The grader doesn’t care how you write your code - it only looks at the returned values.

For-loops can usually be replaced by a vector math operation, such as a dot product. An example is the np.dot() function, which multiplies two vectors and returns the sum of the products of the individual elements.