-3

I tried this but it gave me this error: SyntaxError: illegal expression for augmented assignment.

The input will be something like this: -2 4 -1

x_forces, y_forces, z_forces = 0
x_forces, y_forces, z_forces += map(int, input().split(' '))
martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

1

Is this what you're looking for?

x_forces, y_forces, z_forces = 0, 0, 0
n = [i for i in map(int, input().split(' '))]

x_forces += n[0]
y_forces += n[1]
z_forces += n[2]

print(x_forces, y_forces, z_forces)
Red
  • 26,798
  • 7
  • 36
  • 58