Created
May 19, 2011 12:05
-
-
Save pasali/980599 to your computer and use it in GitHub Desktop.
alistirmalar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fak(n): | |
if n < 0: | |
print "Negatif sayıların faktöriyeli alınamaz." | |
return | |
else: | |
if n == 0 or n == 1: | |
return 1 | |
else: | |
return n * fak(n-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ters_arama(n,a): | |
for i in n.values(): | |
if i == a: | |
sirasi = n.values().index(i) | |
anahtar = n.keys()[sirasi] | |
print anahtar | |
n.pop(anahtar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fi(n): | |
fib = { 0 : 0, 1 : 1, 2 : 1, 3 : 2, 4 : 3, 5 : 5, 6 : 8, 7 : 13, 8 : 21, 9 : 34, 10 : 55} | |
if n > 0 and type(n) == type(4): | |
if n in fib.keys(): | |
return fib[n] | |
else: | |
return fi(n-2) + fi(n-1) | |
else: | |
print "Pozitif tamsayı giriniz !" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sinirsiz_toplam(*args): | |
tp = 0 | |
for i in args: | |
tp += i | |
print tp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment