# Example 6: Using average() from numpy module # Example 5: Using mean() from numpy module # Example 3: Using mean() from statistics module Print("Average Score: ",reduce(add, scores)/len(scores)) # Example 4: Using add() from operator module with reduce() Print("Average Score: ",reduce(lambda i, j: i + j, scores) / len(scores)) # Example 2: Using lambda expression with reduce() Print("Average Score: ",sum(scores) / len(scores)) Quick Examples of Average of a Listįollowing are quick examples of getting the average or mean of elements in the list.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |