Alternate275
Alternate275

Reputation: 13

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

Upvotes: 0

Views: 357

Answers (2)

Omkar Arora
Omkar Arora

Reputation: 166

You should try this one. It will help you understand the operator order better.

(1+(5**(0.5)))/2

Hope this helps

Upvotes: 0

M Z
M Z

Reputation: 4799

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

Upvotes: 1

Related Questions