简体   繁体   中英

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 SUPPOSED to get python to calculate this? 在此处输入图片说明

在此处输入图片说明

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

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

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

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM