Lab 2: Functions and Selection Statements
Logistics
- Due: Thursday, January 24th no later than 11:59 p.m.
- Partner Information: Complete this assignment individually.
- Submission Instructions: Upload your solution, renamed to
YourFirstName-YourLastName-Lab2.py to the BrightSpace Lab 2
Dropbox.
- Deadline Reminder: Once this deadline passes, BrightSpace will no
longer accept your Python submission and you will no longer
be able to earn credit. Thus, if you are not able to fully complete
the assignment, submit whatever you have before the deadline so that
partial credit can be earned.
Learning Outcomes
- Gain experience writing a Python function.
- Gain experience writing Python selection statements.
Assignment
- Download lab2.py and rename
it according to the instructions above.
- Modify the program by adding the missing function. The
missing function will use Python selection statements
to calculate the amount of tax that a single (unmarried)
taxpayer owes using the table below. If the missing function
is implemented correctly, this output
will appear.
Note: the federal tax is progressive. For example, if a person has
a taxable income of $15,000, the first $9,700 is taxed at a rate of 10% and
the remaining $5,300 is taxed at a rate of 12%.
Rate |
For Unmarried Individuals, Taxable Income Over |
10% |
$0 |
12% |
$9,700 |
22% |
$39,475 |
24% |
$84,200 |
32% |
$160,725 |
35% |
$204,100 |
37% |
$510,300 |
Grading - 10 points
- 7 points - Your program calculates the income tax for each
of the seven test cases correctly (1 point each).
- 3 points - A function with the correct name (1 point), correct
parameters (1 point) and correct return value (1 point) is
used in the solution.
If Time Remains
Work on Program 1, seeking feedback as necessary. Program 1
has a deadline of Friday, January 25th at 11:59 p.m.