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ısmında 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)
Quiz
Answer the questions to check your understanding.
This lesson includes a short quiz.
Lesson discussion
Swap insights and ask questions about Python Temel
Be the first to start the discussion
Ask a question or share your thoughts about this lesson.