I need help with a problem asking for lists of numbers (all of which are the same length) using the rule A[i] = A[i] * B[i] + C[i]
at each index i
. After this each A[i]
if A[i] < 0
returns -1.0, otherwise it returns 1.0.
So far I have
def Vecombine(A, B, C):
for i in range(len(A)):
A[i] = A[i] * B[i] + C[i]
return A[i]
if A[i] < 0:
return (-1.0)
I know I need to somehow add in another loop to keep track of the positive and negatives for what is eventually returned but I am just a little confused on how to do that. I also may be way off writing this code... I am trying but I just don't fully understand python.