INNER CODE UNIT · Python
average_odds
webartifex/intro-to-python · 02_functions/sample_module.py:65
def average_odds(numbers, *, scalar=1):
"""Calculate the average of all odd numbers in a list.
Args:
numbers (list of int's/float's): numbers to be averaged;
if non-whole numbers are provided, they are rounded
scalar (float, optional): multiplies the average; defaults to 1
Returns:
scaled_average (float)
"""
return _scaled_average([n for n in _round_all(numbers) if n % 2 != 0], scalar)