Skip to content

Commit 61b59d1

Browse files
committed
fibonacci toying
1 parent b35e025 commit 61b59d1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
clear
4-
time python -u main.py
4+
time python -u main.py #unbuffered output

fibo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
l = [1, 1]
2-
while len(str(l[-1])) < 1000:
2+
total = 0
3+
while l[-1] < 4000000:
34
l.append(l[-1] + l[-2])
4-
print len(l)
5+
l.pop();
56

7+
for n in l:
8+
if not n%2:
9+
total += n
10+
print total, l[-1]

0 commit comments

Comments
 (0)