Python Forum

Full Version: I need help on a basic coding question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So i'm using this site called grok and it asked more to code this:

While spring cleaning your bedroom, you find a bunch of receipts for things you have purchased during the winter. Wanting to know whether you have kept to your budget or not, you decide to add up all the receipts.

Write a Python program to read in a list of integer costs, and print out the total sum of all of the costs. For example:


Enter the expenses: 10 2 5 15
Total: $32

Here is another example:


Enter the expenses: 1 2 3 4 5 100
Total: $115

I'm completely confused any help is appreciated on how you would code it. I'm a beginner so try to explain it in a form that I can understand .
What have you tried?