I’ve been been stuck on this for a couple of days now and thought I’d reach out to LPTHW community.
I think I’ve worked the original formula out correctly, as they both return the same figure, but the problem I’m having is with my own formula. I used the same method to simplify my formula as I did with the example, however its outputting two different figures and I really can’t see why.
So my question is, what have I actually done wrong here and what am I not seeing?
For context I’m a carpenter that is trying to change his career, so please be gentle
Thank you in advance for your time and knowledge!
# Example formula. why = add(age, subtract(height, multiply(weight, divide(iq, 2)))) what = age+height-(weight*iq/2) print("That becomes: ", what,"Can you do it by hand?") print("That becomes: ", why,"Can you do it by hand?") # My formula who = multiply(iq, add(age, subtract(weight, divide(height, 2)))) when = iq*age+(weight-height/2) print("My formula equates: ", who, "using the same numbers as shaws.") print("My formula equates: ", when, "using the same numbers as shaws.")
Example output: Here is a puzzle. DIVIDING 50.0 / 2 MULTIPLYING 180 * 25.0 SUBTRACTING 74 - 4500.0 ADDING 35 + -4426.0 That becomes: -4391.0 Can you do it by hand? That becomes: -4391.0 Can you do it by hand? my formulas output: DIVIDING 74 / 2 SUBTRACTING 180 - 37.0 ADDING 35 + 143.0 MULTIPLYING 50.0 * 178.0 My formula equates: 8900.0 using the same numbers as shaws. My formula equates: 1893.0 using the same numbers as shaws