I'd like to sum the values of an object.

I'm used to python where it would just be:

```sample = { 'a': 1 , 'b': 2 , 'c':3 };
summed =  sum(sample.itervalues()) ```
```The following code works, but it's a lot of code:
```
```function obj_values(object) {
var results = [];
for (var property in object)
results.push(object[property]);
return results;
}

function list_sum( list ){
return list.reduce(function(previousValue, currentValue, index, array){
return previousValue + currentValue;
});
}

function object_values_sum( obj ){
return list_sum(obj_values(obj));
}

var sample = { a: 1 , b: 2 , c:3 };
var summed =  list_sum(obj_values(a));
var summed =  object_values_sum(a)```
```Am i missing anything obvious, or is this just the way it is?
```
Sep 1, 2023 in Python 157 views

## How to get the ASCII values of a character in python?

You can get the ASCII value of ...READ MORE

+1 vote

## Sum the values of column matching and not matching from a .txt file and write output to a two different files using Python

Name                                                    value DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 15657 DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 156579 DR_CNDAOFSZAPZP_GPFS_VOL.2 156579 DR_CNDAOFSZAPZP_GPFS_VOL.3 ...READ MORE

–1 vote

## How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

## How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

## Convert Array to Object

How can I convert this : ['a','b','c'] To this: { ...READ MORE

## Convert Array to Object

What is the best way to convert: ['a','b','c'] to: { ...READ MORE