Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Final Project Help
#1
Good morning everyone, I am working on my final project but am hitting a wall. My assignment is as follows

The 1040EZ is an IRS form for individuals to complete their income taxes. It is easy to complete, hence the “EZ” in the name. In addition to personal information, there are only 14 lines on the 1040EZ. The lines are shown in the Appendix A.
For your final project, you will create a program to allow the user to complete the 1040EZ form. You will notice that some lines on the form require the user to enter information. See lines 1, 2, 3, 7, 8, and 11. Other lines are calculations, which your program needs to perform for the user. See lines 4, 5, 6, 9, 10, 12, 13, and 14.
To complete a program for the 1040EZ you would need to know conditions, but we have not covered them in this course. Conditions will be covered in the next course. So, to make this project easier we will make a few changes to the form. Here are the changes.
1. Line 5 will always be $10,150.
2. On Line 10 it states to look up the amount on a tax table. For this project, Line 10 will be computed as the value of Line 6 multiplied by 0.15.
3. Line 13 is completed if the user gets a refund and Line 14 is completed if the user owes money. Let’s remove Line 14 and say that if the value in Line 13 is negative, the user owes money.
In addition to these requirements there is one requirement concerning how you code this project. All of the values (entered by the user and computed) must be stored in an array.
Below is some sample output. Review it carefully. When you see a “>>” it means that what is to the right of it was entered by the user. Notice that the user does not enter computed values: The program computes them and displays the results.
Sample Output 1
Welcome to the 1040EZ Tax Form Application
1 Wages, salaries, and tips. This should be shown in box 1 of your Form(s) W-2. Attach your Form(s) W-2.
>> 100050.00
2 Taxable interest.
>> 510.15
3 Unemployment compensation and Alaska Permanent Fund dividends.
>> 0.00
4 Add lines 1, 2, and 3. This is your adjusted gross income. $100,560.15
5 If no one can claim you (or your spouse if a joint return), enter $10,150 if single; $20,300 if married filing jointly. See back for explanation. 10,150
6 Subtract line 5 from line 4. If line 5 is larger than line 4, enter -0-. This is your taxable income. $90,410.15
7 Federal income tax withheld from Form(s) W-2 and 1040.
>> 7,876.25
8 Earned income credit (EIC)
>> 0.00
9 Add lines 7 and 8. These are your total payments and credits. $7,876.25
10 Tax. Multiply Line 6 by 0.15. $13,561.52
11 Health care: individual responsibility
>> 0.00
12 Add lines 10 and 11. This is your total tax. $13,561.52

Everything runs smooth until line 9 computes. Instead of computing and automatically going to the next line, it just prints 7876.25. When I hit enter I get this error

Traceback (most recent call last):
File "C:\Users\BlackPearl\Desktop\Project one\final.py", line 15, in <module>
int(input('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1])))
ValueError: invalid literal for int() with base 10: '0.00'

This is the code I ran
print("Welcome to the 1040EZ Tax Form Application")
t = ["","",""]
x = [""]
t[0] = eval (input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2."))
t[1] = eval (input ("Taxable interest."))
t[2] = eval (input ("Unemployment compensation and Alaska Permanent Fund dividends."))
t4 = print("Add lines 1, 2, and 3. This is your adjusted gross income.", + t[0] + t[1] + t[2])
x = 10150
t = t[0] + t[1] + t[2] - x
print("If no one can claim you (or your spouse if a joint return), enter $10,150 if single; $20,300 if married filing jointly. See back for explanation.", x)
print("Subtract line 5 from line 4.", t)
z = ["",""]
z[0] = eval (input ("Federal income tax withheld from Form(s) W-2 and 1040."))
z[1] = eval (input ("Earned income credit (EIC)"))
int(input('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1])))
b = [""]
b[0] = t * 0.02
print("Tax. Multiply Line 6 by 0.15.", b)
d = [""]
d[0] = eval (input ("Health care: individual responsibility"))
c = [""]
c[0] = print("Add lines 10 and 11. This is your total tax.", b[0] + d[0])
print("If line 9 is larger than line 12, subtract line 12 from line 9. This is your refund.")
You guys were a great help on my arrays assignment so I hope you can help me figure this out as well. I need that line to just print and go to the next line
Reply
#2
If you are expecting the user to press enter at that point, you should not be converting it to int (line 15). You should just do nothing with it.

Note that t4 on line 7 is always going to be None, because you are using print instead of input. I would also say that eval is overkill for this situation. I would use int or maybe float.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
Ok I'll change everything to int. The line in question I don't want the user to do anything for that line I just want it to print and automatically go to the next after it does the calculation. I tried recoding it a few ways but couldn't get it to worm
Reply
#4
If you want to print and move on, use print (that is, print(...) instead of int(input(...))).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
Switched everything out and the code works as long as I don't put in a . if i do i get this error
Traceback (most recent call last):
File "C:\Users\BlackPearl\Desktop\Project one\final.py", line 4, in <module>
t[0] = int(input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2."))
ValueError: invalid literal for int() with base 10: '100050.00'

Here is the code
print("Welcome to the 1040EZ Tax Form Application")
t = ["","",""]
x = [""]
t[0] = int(input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2."))
t[1] = int(input ("Taxable interest."))
t[2] = int(input ("Unemployment compensation and Alaska Permanent Fund dividends."))
t4 = print("Add lines 1, 2, and 3. This is your adjusted gross income.", + t[0] + t[1] + t[2])
x = 10150
t = t[0] + t[1] + t[2] - x
print("If no one can claim you (or your spouse if a joint return), enter $10,150 if single; $20,300 if married filing jointly. See back for explanation.", x)
print("Subtract line 5 from line 4.", t)
z = ["",""]
z[0] = int(input ("Federal income tax withheld from Form(s) W-2 and 1040."))
z[1] = int(input ("Earned income credit (EIC)"))
print('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1]))
b = [""]
b[0] = t * 0.02
print("Tax. Multiply Line 6 by 0.15.", b)
d = [""]
d[0] = int(input ("Health care: individual responsibility"))
c = [""]
c[0] = print("Add lines 10 and 11. This is your total tax.", b[0] + d[0])
print("If line 9 is larger than line 12, subtract line 12 from line 9. This is your refund.")
update:
I changed it to float instead of int and that seems to have fixed the . issue. Thanks so much for the help
Reply
#6
I only suggested int because tax calculations are usually done on whole dollars. But if your are entering the cents, you would want to use float.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#7
(Feb-06-2019, 03:12 AM)ichabod801 Wrote: I only suggested int because tax calculations are usually done on whole dollars. But if your are entering the cents, you would want to use float.
I strongly recommend not using floats for serious dealing with money, my understanding is that such calculations are typically done with ints in cents, unless you need more precision than that.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Smile Final Projet - Credit Risk Rauchvant 3 2,374 Nov-18-2020, 03:21 PM
Last Post: Rauchvant
  Help needed, stuck at the final output extricate 0 1,513 Jun-20-2020, 05:35 AM
Last Post: extricate
  Final Project (Databases, GUI, and Classes) poochenthecreator 1 1,616 Apr-27-2020, 09:58 PM
Last Post: deanhystad
  Trouble with edX Python Final sarah_mb_sues 11 13,611 Jun-19-2018, 10:36 AM
Last Post: cryomick
  Final problem Truman 4 3,980 Jan-22-2018, 11:42 PM
Last Post: Truman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020