Menu

gitpiper

average python Code Snippet in 2024

mathlistbeginner

Last Updated: 9 April 2024

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 April 2024

Subscribe to our Newsletter

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

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