Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions questions/Tracking Income
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Tracking Income

## Question

Welcome to **Tracking Income**! Here is the problem statement:

You are given a list of revenue and expenses incurred by your company. Revenue is money coming in, Expensises is money going out. Your job is to write a code to calculate how much money the company has at the end of the day.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"write a code" -> "write a program"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You are given a list of revenue and expenses incurred by your company. Revenue is money coming in, Expensises is money going out. Your job is to write a code to calculate how much money the company has at the end of the day.
You are given a list of revenue and expenses incurred by your company. Revenue is money coming in, Expenses is money going out. Your job is to write a code to calculate how much money the company has at the end of the day.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could make more of a story here. Like give a scenario where its like "You are the accountant of a big company are you are trying to track money in and money out to make sure the company is not overspending. Here is a balance sheet of the day. Figure out if the company is making money,

Copy link
Collaborator

@shannonpaul3 shannonpaul3 Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You are given a list of revenue and expenses incurred by your company. Revenue is money coming in, Expensises is money going out. Your job is to write a code to calculate how much money the company has at the end of the day.
You are given a list of revenue and expenses incurred by your company. Revenue is money coming in, Expenses is money going out. Your job is to write code that calculates how much money the company has at the end of the day.


##Input

```python
Money = [200, -12, 5, -6, 18, -25, -30, 20]
```
The first element in `Money` indicates the amount of money the company has at the start of the day. The rest of the elements in the list indicate the amount of money being earned or spent throughout the day. The company should spend 12 dollars, earn 5, spend 6, earn 18, spend 25, spend 30, then earn 20 before the end of the day.

Therefor your function should return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

therefore is spelt wrong

```python
170
```
Comment on lines +12 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would store the starting amount as a separate variable

Here are some criteria for marking someone's code:

- Correctness: Does the code produce correct results for all test cases?
- Readability: Is the code easy to read and understand?
- Efficiency: Does the code run efficiently?
- Style: Does the code follow good coding style and conventions?

Here is a sample solution in Python:

```python
def Income(Money):
return sum(Money for Money in Money)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solution could be rewritten to be a little more clearer


```