All problems
Simple Array Sum
easyPythonArrays
A market stall keeps its books on one line per day: every transaction of the day written out in order, separated by spaces. A sale is a positive number and a refund is a negative one. At closing time the stallholder wants the day's net figure.
Task: Read one day's transactions and print their total.
Input
A single line holding between 1 and 100 integers, separated by single spaces. Any of them may be negative or zero. The count is not given anywhere — the line holds whatever it holds.
Output
One line holding a single integer: all the values on the line added together.
Example:
Input:
1 2 3 4 5
Output:
15
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in