#π Help please
46 messages Β· Page 1 of 1 (latest)
@abstract panther
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
What is your code producing?
total tax depending over if one is married, income, and elevation of their home address
I mean literally. You said it's producing the wrong answer.
Sorry code is running 448.9704
not 601.9
I'd verify that all the values used in the code are correct. You have a lot of "magic numbers" floating around (like 0.023), and there's no way for us to verify those.
What are the instructions?
β’ the amount of total income for the year (in dollars)
β’ the marital status of the user (single/married)
o If the user is married, how long have they been married
β’ the current elevation of the userβs home address (below/at/above sea level)
o If the user lives above sea level, how many bedrooms are in their house
Your program should produce as output the amount of income tax owed for that year.
The process for calculating the amount of tax owed is as follows:
Yearly Income
β’ If the yearly income is less than $10,000, income tax is 2.3% of income
β’ If yearly income is greater than or equal to $10,000 but less than or equal to
$50,000, income tax is 4.5% of income
β’ If yearly income is greater than $50,000, income tax is 6.1% of income
Marital Status:
β’ If the user is single, no changes are made
β’ If the user is married, ($1.62 * years_married) is subtracted from the income tax
Current Elevation:
β’ If the user lives below sea level, they are either a fish or a cave person and a
processing fee of $18.32 is added to the income tax.
β’ If the user lives at sea level, they must be a ship captain and are subject to
import fees. 1.6% of income is added to the income tax
β’ If the user lives above sea level, a $5.00 charge per bedroom is added to the
income tax```
1.6% of income is added to the income tax
isnt 1.6% is .016?
Yep. And what are you multiplying that with?
tax
Yep, and what do the instructions say to use?
ohhhh... so add it to the income instead?
Yep. I verified that that fixes it
Wait, don't add it to the income. Mutliply it by the income.
1.6% of income
Not "1.6% of income tax"
but then where in the code would it be wrong? Im assuming line 13?
This is the level two elevation calculation. Note the instructions.
If the user lives at sea level, they must be a ship captain and are subject to
import fees. 1.6% of income is added to the income tax
okay so lines 22-23
1.6 of income is added to the income tax so im still confused partially
mb again @rugged trout
What are you confused about?
I guess where to edit it because it states 1.6 is addeded to the income tax, so then comparing that to my code, lines 22-23 is that area. When i swap it to + it doesnt work. But you say I have to multiply it but doesnt work still
I think im in the wrong area of the code to fix it
which is what keeping me still stuck here
You're supposed to add to the tax. But you add 1.6% of income, not 1.6% of tax.
You're currently adding 1.6% of the tax.
You want to add 1.6% of the income.
tax += tax * .016
This is what you currently have (or did have).
π
so it registered @rugged trout
instead do
tax += income * .016
right? @rugged trout
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
π Help please