+0

# PYTHON HELP PLS!!!!!

0
132
4

Write your Python code to approximate the Golden Ratio by using this formula:

$$\phi_{n+1}=1+\frac{1}{\phi_n} \text{ and } \phi_0=1$$

a) Program the codes and prints the result after 20 iterations using the iteration method.
b) Program the codes by calling a function recursively. Print the result after calling the function
20 times.

Jun 6, 2020

#1
0

I do java and c++, a little bit of python, though, but.....!

Jun 6, 2020
#2
0

nice! so can you help? :)

#3
0

Part a: This is NOT in Python, but use as a guide:

i=1; g=(2#5)/2; g=1/g + 1; printg;i++;if(i<=20, goto2, 0)

PRINT 20 ITERATIONS:

1.894427191
1.527864045
1.654508497
1.604409105
1.623282426
1.616035746
1.618798193
1.617742226
1.618145452
1.617991416
1.61805025
1.618027777
1.618036361
1.618033083
1.618034335
1.618033857
1.618034039
1.618033969
1.618033996
1.618033986

Jun 6, 2020
#4
0

I believe StackOverflow would be much more useful.

I don't do python normally, usually Java, C/C++, HTML, stuff like that.

I never studied the Golden Ratio so idk how it works but you might want something like this

for i in range(1,20):

(content)

Idk.

Jun 6, 2020