Skip to content

Instantly share code, notes, and snippets.

@gceylan
Created March 28, 2012 17:10
Show Gist options
  • Save gceylan/2228297 to your computer and use it in GitHub Desktop.
Save gceylan/2228297 to your computer and use it in GitHub Desktop.
1-3 fonksiyonlarında ufak düzeltmeler...
# -*- coding: cp1254 -*-
def en_buyuk_ardil_toplam(dizi):
print "girilen dizi:", dizi
for ind, i in enumerate(dizi):
if ind == 0:
continue
dizi[ind] = dizi[ind] + dizi[ind - 1]
print "Ardıl dizi:", dizi
return max(dizi)
#print en_buyuk_ardil_toplam([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1])
def str_fark(str1, str2):
for i in str1:
if i not in str2:
return i
#str_fark("abcde", "dafbck")
def simetrik_fark(str1, str2):
result = ''
string = str1 + str2
for i in string:
if string.count(i) == 1:
result += i
return result
#print simetrik_fark("abcde", "dafbck")
#print simetrik_fark("dafbck", "abcde")
def str3topla(str):
toplam = 0
for i in str:
if i in "1234567890":
i = int(i)
if i % 3 == 0:
toplam += i
return toplam
#print str3topla("a23s56e9x")
def bstr(samanlik, igne):
n = 0
for i in range(0, len(samanlik)):
if samanlik[i] == igne[0]:
for j in range(1, len(igne)):
if samanlik[i + j] == igne[j]:
n += 1
if n == 3:
return i
return -1
#print bstr("1101101011", "1010")
def hecesay(cumle):
sesliler = "aeiouAEIOU"
bosluk = 0
hece = 0
j, k = 0, 0
for i in cumle:
if i == ' ':
bosluk += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment