Mar-02-2017, 03:32 PM
I have an array to do some calculation for each element, which looks like this:
a_1 = [[2, 6, 3], [5, 12, 6], [8, 18, 9]]
I wrote the following lines:
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]My expected results is as follow after calculation:
a_1 = [[2, 6, 3], [5, 12, 6], [8, 18, 9]]
I wrote the following lines:
f = 1 g = 2 a_1 = [c +f, (d+f)*g, e for (c, d, e) in array]However it is error message like this:
Error:SyntaxError: invalid syntax
How to amend the code to get the results I want? One more requirement is I don't want to use NumPy.