internal.analytics.co2_estimator
CO2e estimator for rescued food items.
1"""CO2e estimator for rescued food items.""" 2 3from statistics import mean 4 5 6def estimate_carbon_doixide_saved( 7 category_coefficients: list[float], weight_g: int 8) -> int: 9 """Return the estimated CO2e saved (g). 10 11 Args: 12 category_coefficients: The food category coefficients 13 weight_g: bundle weight in grams 14 15 Returns: 16 estimated carbon dioxide saved. 17 """ 18 coefficient = mean(category_coefficients) 19 return int(weight_g * coefficient)
def
estimate_carbon_doixide_saved(category_coefficients: list[float], weight_g: int) -> int:
7def estimate_carbon_doixide_saved( 8 category_coefficients: list[float], weight_g: int 9) -> int: 10 """Return the estimated CO2e saved (g). 11 12 Args: 13 category_coefficients: The food category coefficients 14 weight_g: bundle weight in grams 15 16 Returns: 17 estimated carbon dioxide saved. 18 """ 19 coefficient = mean(category_coefficients) 20 return int(weight_g * coefficient)
Return the estimated CO2e saved (g).
Arguments:
- category_coefficients: The food category coefficients
- weight_g: bundle weight in grams
Returns:
estimated carbon dioxide saved.