I have this code that adds the sum of rows in a matrix:
matrix = [[1,1,1],[1,2,2],[1,0,0]]
answer = str([sum(row) for row in matrix])
print answer
But answer
is a string that looks like [3, 5, 1]
.
How can I convert answer
to be x
variables using a loop (without .join)?
Example if answer = [3, 5, 1]
It should be :
answer1 = "3"
answer2 = "5"
answer3 = "1"