Python

Average Test Score

Program will calculate the average of a group of input numbers

Here is a program that shows how a python list comprehension can be used to solve a problem with a minimal amount of code.

This program will ask the user to input numbers separated by commas. The comprehension creates a list of individual numbers, and then a function returns the average of the numbers.

Example:

> python avg_test.py

> This program computes the average of three exam scores.

> Enter the scores separated by commas (ex 5,2,1): 2, 3 ,4,5

> 3.50