Skip to content

Instantly share code, notes, and snippets.

@aligoren
Last active December 21, 2015 03:38
Show Gist options
  • Save aligoren/6243145 to your computer and use it in GitHub Desktop.
Save aligoren/6243145 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
def f(x):
'''gelen sayiya 5 ekle fonksiyon olayi'''
print('x parametresinin aldigi deger: ', x)
y=x+5
print('Hesaplama sonucu: ', y)
return y
f(3)
#help(f) yardim cagiriyor. yapilan is gibi hani
def carp(a,b):
'''a ve b degerlerinin carpimini alacak'''
print('Cikan sonuc', a*b, sep=': ')
carp(5,5)
def topla(a,b):
'''a ve b degerlerini toplar'''
print('Cikan sonuc', a+b,sep=': ')
topla(5,7)
def cikar(a,b):
'''a ve b sayilarinin farkini verir'''
print('Cikan sonuc', a-b,sep=': ')
cikar(10,3)
def bolme(a,b):
'''a ve sayilarinin bolumlerini verir'''
print('Cikan sonuc', a//b, sep=': ')
bolme(15,4.5) #tam sonuc icin // kondu. cunku tek bolude sonuc: 3.3333333333333335
def kokAl(sayi, derece=2):
'''kok aliyoruz burada, okuyom ben yeaa'''
kok=sayi**(1/derece)
print('Cikan sonuc', kok, sep=': ')
kokAl(30) # burada cikan sonuc kesirli oldu.. eger cift bolu kullanilsaydi 1 cikiyordu. bunu anlamadim nasil tersine yuvarlamadi bu?
#simdi biz bunun 2. dereceden kokunu alan islevini calistiralim
kokAl(81,2) # muhtemel sonuc olarak 9 olmali.. 4. koku 3 ediyorsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment