Did I find the right examples for you? yes no

# gristle.field_math.get_mean_length

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)
```Returns the mean (average) length of the input.  Ignores unknown
values, if no values found besides unknown it will just return 'None'

Inputs:
- a dictionary of frequency distribution - with all data of a
string type, and character keyss and numeric data representing
occurances of the keys.  Exceptions will be ignored.
Outputs:
- a single value - the mean of the inputs
Test Coverage:(more...)
```

```        def get_mean_length(values):
""" Returns the mean (average) length of the input.  Ignores unknown
values, if no values found besides unknown it will just return 'None'

Inputs:
- a dictionary of frequency distribution - with all data of a
string type, and character keyss and numeric data representing
occurances of the keys.  Exceptions will be ignored.
Outputs:
- a single value - the mean of the inputs
Test Coverage:
- complete via test harness
"""
accum   = 0
count   = 0
for value in values:
if not field_type.is_unknown(value):
try:
accum += len(value) * int(values[value])
count += int(values[value])
except ValueError:
pass                # usually 'unknown values', sometimes garbage
try:
return accum / count
except ZeroDivisionError:
return None
```

```                self.field_min_length[f_no]  = miscer.get_min_length(self.field_freqs[f_no])
self.field_max_length[f_no]  = miscer.get_max_length(self.field_freqs[f_no])
self.field_mean_length[f_no] = mather.get_mean_length(self.field_freqs[f_no])
else:
self.field_case[f_no]        = None
```

```                self.field_min_length[f_no]  = miscer.get_min_length(self.field_freqs[f_no])
self.field_max_length[f_no]  = miscer.get_max_length(self.field_freqs[f_no])
self.field_mean_length[f_no] = mather.get_mean_length(self.field_freqs[f_no])
else:
self.field_case[f_no]        = None
```

```    def test_math_g01_emptiness(self):
assert mod.get_mean_length(self.empty_dict_1) is None

def test_math_g02_unknowns(self):
assert mod.get_mean_length(self.unk_dict)    == 1
```
```    def test_math_g05_medium_sets(self):
assert mod.get_mean_length(self.med_dict_1)  == 1.5

```

```    def test_math_g01_emptiness(self):
assert mod.get_mean_length(self.empty_dict_1) is None

def test_math_g02_unknowns(self):
assert mod.get_mean_length(self.unk_dict)    == 1
```
```    def test_math_g05_medium_sets(self):
assert mod.get_mean_length(self.med_dict_1)  == 1.5

```