Jump to content

#Miguel
#
#
#
#Program shall generate income tax based upon user input.

 

income = float(input("Enter Your amount of income here ---->:"))
print("The income you provided is -->", income)
user_config = str(input("Is this number correct? Enter y or n : "))
if user_config.upper() == "Y":
    
        print ("Sucsesful, we shall proceed . ")    
else :
        print ("Craaashhh restart the program and re-enter the value")
        exit()
#
#
tax = 0.0
if income <= 50000:
    tax = tax
    print("Low income , no need to tax   " , tax )
elif income >= 50000 and income <= 75000:
    tax = (tax + .05) * income
    print ("5 % tax calculated :   " , tax )
elif income >= 75000 and income <= 100000:
    tax = (tax +.07) * income
    print ("7 % tax calculated :   " , tax )
else: 
    income > 100000
    tax = (tax + 0.1) * income
    print ("10 % tax calculated :   " , tax)

 

 

 

 

 

 

 

im getting an error and i cant pin point where its comming from. 

Link to comment
https://linustechtips.com/topic/732028-python-help/
Share on other sites

Link to post
Share on other sites

1 minute ago, fizzlesticks said:

What error are you getting and please use code tags.

code tags?

this program was working before ... i didnt do anything 
Traceback (most recent call last):
  File "C:\Users\004306418\Downloads\hmk2 parta\HMK2PARTa.code.py", line 9, in <module>
    user_config = input("Is this number correct? Enter y or n : ")
  File "<string>", line 1, in <module>
NameError: name 'y' is not defined
>>> 

Link to comment
https://linustechtips.com/topic/732028-python-help/#findComment-9300059
Share on other sites

Link to post
Share on other sites

8 minutes ago, Nipplemilk909 said:

code tags?

The big announcement at the top of the page.

https://linustechtips.com/main/announcement/12-please-use-code-tags/

 

You're problem is you seem to be writing Python 3 but running it in Python 2. With Py3 your code works fine. In Py2, if you want a string as input you need to use the raw_input() function not plain input().

1474412270.2748842

Link to comment
https://linustechtips.com/topic/732028-python-help/#findComment-9300087
Share on other sites

Link to post
Share on other sites

8 minutes ago, fizzlesticks said:

The big announcement at the top of the page.

https://linustechtips.com/main/announcement/12-please-use-code-tags/

 

You're problem is you seem to be writing Python 3 but running it in Python 2. With Py3 your code works fine. In Py2, if you want a string as input you need to use the raw_input() function not plain input().

thank you, didnt realize my schools comp has pv2 

Link to comment
https://linustechtips.com/topic/732028-python-help/#findComment-9300111
Share on other sites

Link to post
Share on other sites

15 hours ago, Nipplemilk909 said:

code tags?

Capture.PNG

When used, it looks like this:

 

#Miguel
#
#
#
#Program shall generate income tax based upon user input.
 
income = float(input("Enter Your amount of income here ---->:"))
print("The income you provided is -->", income)
user_config = str(input("Is this number correct? Enter y or n : "))
if user_config.upper() == "Y":
    
        print ("Sucsesful, we shall proceed . ")    
else :
        print ("Craaashhh restart the program and re-enter the value")
        exit()
#
#
tax = 0.0
if income <= 50000:
    tax = tax
    print("Low income , no need to tax   " , tax )
elif income >= 50000 and income <= 75000:
    tax = (tax + .05) * income
    print ("5 % tax calculated :   " , tax )
elif income >= 75000 and income <= 100000:
    tax = (tax +.07) * income
    print ("7 % tax calculated :   " , tax )
else: 
    income > 100000
    tax = (tax + 0.1) * income
    print ("10 % tax calculated :   " , tax)


Much nicer

ENCRYPTION IS NOT A CRIME

Link to comment
https://linustechtips.com/topic/732028-python-help/#findComment-9302629
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×