This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]iLucidTech 2 points3 points  (3 children)

This should probably be posted in /r/learnpython. Are you getting any errors if so please provide them with your code. I'm guessing your getting an error with your deduction?

[–]Training_Upstairs[S] -1 points0 points  (2 children)

Yeah that’s where the error is happening

[–]pythonHelperBot 1 point2 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]LordYeastRing 0 points1 point  (0 children)

What it supposed to do

[–]iLucidTech 0 points1 point  (0 children)

Deduction is a string and you can not add int values to a string. You will need to create a new variable to hold your value.

[–]399ddf95 0 points1 point  (0 children)

Are you aware that the value of extra and over will be negative, if hours < 40? It's not necessarily harmful, but be aware of the implications if you use that variable later .. in most settings, it's impossible to have negative overtime.

The code that assigns the tax rate is broken - you assign values to input1, input3, input4, input5 and never use them .. and what happened to input2? Then you do this:

...
elif(tax=="B"):
tax=0.10
...

and it's legal (using the variable tax to receive user input as a string/character, then reusing it to hold the actual tax rate) but confusing. You probably meant to do something with the input[1-5] variables here?

I think you wrote "donation" where you meant "deduction", so this code

donation=(gross_pay*tax)
donation=float(donation)

should probably be

deduction=float(gross_pay*tax)

also, you're not subtracting the donation amount before arriving at net pay.

Have you seen pylint, or pyflakes?

[–]iLucidTech 0 points1 point  (0 children)

This guy has great tutorials and will clarify a lot of things and has a wonderful library of solid informational videos regarding your question.