[ create a new paste ] login | about

Link: http://codepad.org/bMAhwrc5    [ raw code | output | fork ]

computermusicneix - Python, pasted on Jan 31:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# nxSnippet001.py
# Fibonacci
# 2009.01.31

primer = 300
scale_range = 16
a = 0.2
b = 0.8
sum_scale = []
scale = []

for i in range(scale_range):

    sum_scale.append(b)
    scale.append(b+primer)
    a, b = b, a+b

print sum_scale
print scale
  


Output:
1
2
[0.80000000000000004, 1.0, 1.8, 2.7999999999999998, 4.5999999999999996, 7.3999999999999995, 12.0, 19.399999999999999, 31.399999999999999, 50.799999999999997, 82.199999999999989, 133.0, 215.19999999999999, 348.19999999999999, 563.39999999999998, 911.59999999999991]
[300.80000000000001, 301.0, 301.80000000000001, 302.80000000000001, 304.60000000000002, 307.39999999999998, 312.0, 319.39999999999998, 331.39999999999998, 350.80000000000001, 382.19999999999999, 433.0, 515.20000000000005, 648.20000000000005, 863.39999999999998, 1211.5999999999999]


Create a new paste based on this one


Comments: