-
Notifications
You must be signed in to change notification settings - Fork 2
Added question about tracking income #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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,
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| ##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 | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. therefore is spelt wrong |
||||||||||
| ```python | ||||||||||
| 170 | ||||||||||
| ``` | ||||||||||
|
Comment on lines
+12
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||||||||||
dazaiworms marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| ```python | ||||||||||
| def Income(Money): | ||||||||||
| return sum(Money for Money in Money) | ||||||||||
|
|
||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. solution could be rewritten to be a little more clearer |
||||||||||
|
|
||||||||||
| ``` | ||||||||||
There was a problem hiding this comment.
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"