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: $")


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":
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":
wagecombined= wage1 + wage2

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

    print ("$") + `leftover` + ("is what you are short.")

print("These numbers are rough estimates.")

raw_input("Press Enter to exit")

Recommended Answers

All 2 Replies

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, learning, and sharing knowledge.