Menu

gitpiper

average python Code Snippet in 2022

mathlistbeginner

Last Updated: 26 November 2022

Calculates the average of two or more numbers.

  • Use sum() to sum all of the args provided, divide by len().
def average(*args): return sum(args, 0.0) / len(args)
average(*[1, 2, 3]) # 2.0 average(1, 2, 3) # 2.0

python snippet similar to average For You in November 2022

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2022 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️