Jump to content

# Ist 28
#Hmk2B
# Program will calculate tax payable in married or single income. 

print ("Hello, lets start")
print (".")

income = float(input ("What is your income? "))

print (".")
print ("Income is ...: ", income) 
print ("Next..... ")

single_or_married = str(input("Are you married or single? enter m or s"))


print ("This is the status you entered....:" , single_or_married)
print (".")
print ("If the income is wrong then restart program ")

#IF ELSE
if upper.single_or_married() == "S":
  print ("Single Life")
  
  if (income > 0) and (income <= 8000):
    tax = 0.1 * income 
    
  elif(income > 8000) and (income <= 32000):
    tax = 800 + 0.15 * (income - 8000)
    
  else :
    tax = 4400 + 0.25 * (income - 32000)
    
else :
  if upper.single_or_married() == "M":
    print ("Married life!")
  
  if (income <= 80000):
    tax = .1 * income 
    print (tax) 
  else:
    tax = 0.25 * (income -8000)
print ("The tax is : " , tax)

out put and error im getting is 

Income is ...:  28000.0
Next..... 
Are you married or single? enter m or s s
This is the status you entered....: s
.
If the income is wrong then restart program 
Traceback (most recent call last):
  File "main.py", line 24, in <module>
    if upper.single_or_married() == "S":
NameError: name 'upper' is not defined
exited with non-zero status   
Link to comment
https://linustechtips.com/topic/733478-python-program-help/
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

×