Skip to content

Latest commit

 

History

History
114 lines (48 loc) · 745 Bytes

File metadata and controls

114 lines (48 loc) · 745 Bytes

Birden Çok Input

  • Fonksiyonların birden çok parametresi olabilir
def square(x):
    return x *x
square(3)
9
def power(x, y):
    
    return x ** y
    
power(2, 3)
8

Birden Çok Değer Döndüren Fonksiyonlar

def f(x):
    
    return 2*x, 10*x
f(10)
(20, 100)
  • Bana sonucu tuple olarak döndürdü

  • Variable Unpacking kısımda gördüğümüz gibi bu iki değeri farklı değişkenlere eşitleyebilirim

a, b = f(10)
a
20
b
100
def f(x,y):
    
    return 2*x*y, (10*x)**y
f(10,2)
(40, 10000)