#πŸ”’ Help please

46 messages Β· Page 1 of 1 (latest)

stark steepleBOT
#

@abstract panther

Python help channel opened

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.

rugged trout
#

What is your code producing?

abstract panther
#

total tax depending over if one is married, income, and elevation of their home address

rugged trout
#

I mean literally. You said it's producing the wrong answer.

abstract panther
#

Sorry code is running 448.9704

abstract panther
rugged trout
#

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?

abstract panther
#
β€’ 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```
rugged trout
#

1.6% of income is added to the income tax

abstract panther
#

isnt 1.6% is .016?

rugged trout
#

Yep. And what are you multiplying that with?

abstract panther
#

tax

rugged trout
#

Yep, and what do the instructions say to use?

abstract panther
#

ohhhh... so add it to the income instead?

rugged trout
#

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"

abstract panther
rugged trout
#

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

abstract panther
#

okay so lines 22-23

#

1.6 of income is added to the income tax so im still confused partially

#

mb again @rugged trout

rugged trout
abstract panther
#

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

abstract panther
rugged trout
#

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).

abstract panther
#

😎

#

so it registered @rugged trout

#

instead do

#

tax += income * .016

#

right? @rugged trout

rugged trout
#

There you go

#

Glad you got it.

abstract panther
#

πŸ™ you're the goat @rugged trout

#

appreciate the help

stark steepleBOT
#
Python help channel closed

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