Menu

gitpiper

average python Code Snippet in 2023

mathlistbeginner

Last Updated: 20 September 2023

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 September 2023

Subscribe to our Newsletter

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

© 2023 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! ✌️