Python

Sum with Command Line

Sum the numbers on the command line using argv

This function uses the argv function from sys to capture numbers on the command line and then return their sums.

Example:

> python add.py

> 0

> python add.py 1 1 1

> 3.0

> python add.py 1 1 2

> 4.0

> python add.py 1 1 2.1

> 4.1