Search code examples
pythonexpressionequationarithmetic-expressions

Python- Calculate this equation / expression


I have tried two different syntax's and when I ran the syntax's I got the mathmatical resolution in both attempts, but my quiz is wanting a specific line of code to get the result. Any idea how I'm S U P P O S E D to get python to calculate this? enter image description here

enter image description here


Solution

  • This is not really a python problem and more a maths order of operations problem.

    In both examples you provide, you are adding the 1 after you divide (5**(1/2)/2).

    You want this:

    ratio = (1 + 5**(1/2)) / 2