Skip to content

Instantly share code, notes, and snippets.

@hasayvaz
Created March 18, 2011 18:28
Show Gist options
  • Select an option

  • Save hasayvaz/876581 to your computer and use it in GitHub Desktop.

Select an option

Save hasayvaz/876581 to your computer and use it in GitHub Desktop.
fibonacci serisini göze alarak, serideki değerlerin hepsinin toplamını bulan program
#!/usr/bin/python
#-*-coding:utf-8-*-
def fibo(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n > 1:
return fibo(n - 1) + fibo(n - 2)
else:
print "lutfen negatif olmayan bir sayı giriniz "
a = []
top = 0
sayi = input("fibonacci serisi hesaplanacak sayı giriniz : ")
for t in range(sayi):
fibo(t)
a.append(fibo(t))
for h in a:
top += h
print "fibonacci dizisi : ", a
print "fibonacci dizisindeki değerlerin toplamı : ", top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment