0

I am trying to add the elements that are in a row vector to a 1X1 vector in python, Problem: [10 100]

Solution: [110]

Is there any way to achieve this?

aniket32
  • 25
  • 1
  • 7

2 Answers2

1

Example provided in question is more of a list.

To sum up all the elements in a list, sum() function can be used.

e.g: sum([10 100]) //output: 110

ruakn
  • 188
  • 1
  • 9
0

This could be done in one line:

example_list = [10, 100]

print([sum(example_list)])

Output: [110]

kcper
  • 41
  • 5