I just started learning python and decided to try and put what I have learned to use in a program and I am having issues with the math I believe. Any suggestions?

print ("Lets get some utlities information")
rent=input("What is your monthly rent: $")
pge=input("Estimated PG&E Bill: $")
water=input("Estimated Water Bill: $")
phone=input("Estimated Cell Phone Bill: $")
car=input("Estimated Car Payment: $")
insurance=input("Estimated Car Insurance: $")
utilities=input("Estimated Other Utlities: $")
other=input("Estimated spending for groceries, entertainment, and pets: $")

total=rent+pge+water+phone+car+insurance+utilities+other
total=round(total,2)

print ("Your total bills comes out to $") + `total`

print ("Lets get some information about you and your partner")
pay1=raw_input("User 1 are you hourly or salary? ")
wage1=input("How much do you get paid? $")
hours1=input("How many hours a week? ")
withholdings1= wage1*hours1*52*0.1765
if pay1 == "hourly":
    wage1=wage1*hours1*52-withholdings1/12
else:
    wage1=wage1/12.0-withholdings1
pay2=raw_input("User 2 are you hourly or salary? ")
wage2=input("How much do you get paid? $")
hours2=input("How many hours a week do you work? ")
withholdings2= wage2*hours2*52*0.1765
if pay2 == "hourly":
    wage2=wage2*hours2*52-withholdings2/12
else:
    wage2=wage2/12.0-withholdings2
    
wagecombined= wage1 + wage2
wagecombined=round(wagecombined,2)
leftover=wagecombined-total

leftover=round(leftover,2)
if leftover > 0:
    print("You will have $") + `leftover` + (" left over after bills.")
elif leftover == 0:
    print ("You will break even")
else:
    print("You will not have enough money to cover bills.")

    leftover=total-wagecombined
    leftover=round(leftover,2)
    print ("$") + `leftover` + ("is what you are short.")

print("These numbers are rough estimates.")

raw_input("Press Enter to exit")

You did not post error message or something like it. Looks like you are repeating almost same code, use functions. Also why you ask hours if salary is not per hour?

Hey pyTony, I am not getting any error messages. I just noticed a problem when trying to figure out how much I will have left over every month after all the bills have come out.

I have not learned functions yet as I am very new to programming. I decided to just put what I have learned to use in a program. I will look into functions later on today or tomorrow after school work is done.

I also did not notice it was asking hours if the person is salary. I will fix that also.

Thanks for the reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.