PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""most peeps have learned about the golden ratio and the Fibonacci sequence.
Not everyone knows that you can start the sequence with any two numbers (not just 0 & 1), and within 9 itterations the ratio of the two numbers will be close to the golden ratio
pick any two integers and see what happens!
seperate numbers with a space
works with ±ve integers and one 0"""
golden = 1.61803398875 #golden ratio ia irrational so this is an approximation
tol = 0.01 #how close a ratio must get to golden
def compare(a, b, tolerance):
if a>= b-tolerance and a <=b+tolerance: return True
else: return False
list = (input("give me numbers\n\n").split())
a=int(list[0])
b=int(list[1])
if a > b : a,b = b,a
elif a==0 and b ==0 : a,b= 0, 1
ratio = b/a if a!=0 else 0.0
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run