Cohorts
  • Discover
  • About Us
  • Blog
  • Patika.dev
  • Web3

Python Temel

Programlama Nedir?
Jupyter Notebook
Temel Veri Tipleri
Değişken Atama
Kafa Karışıklığı
Operatörler ve İfadeler

Stringler
Stringler Üzerinde Operatörler
Stringlerde İndexleme
Stringlerde Casting

Input

Koda Yorum Ekleme

Sayısal Verilerde Karşılaştırma
Stringlerde Karşılaştırma
Mantıksal Operatörler
Short-circuit
Short-circuit Olmayan Mantıksal Operatörler

If-else-elif
Ternary Conditionals

Döngüler
while
for
Continue-Break

List
Tuple
in
Dictionary
Set
Non-scalar Veri Tiplerinde For
Split-Join
List Comprehension
Variable Unpacking
Enumerate-Zip

Fonksiyonlar
return
Comment-Fonksiyon
Birden Fazla Değer Döndürme/input İçerme
Predefined Parameters
Update Input
First Class Function
For-Function

Underscore Placeholder

fstring

Proje

Variable Unpacking


  • Şimdiye kadar hep tek değişkene tek değer verdik.


  • Peki bir seferde birden çok değişkene değer vermek için ne yaparız?


  • Aşağıdaki kodun sonucu,

x=4

y=7

ile aynı

x, y = (4, 7)


x


4


y


7


  • 2'den çok değere de bunu yapabiliriz.


x, y, z = (4, 7, 11)


print(x, y ,z)


4 7 11


Bazı Değerlere İhtiyacım Yoksa:


  • Diyelim ki soldaki yapının sadece birinci elemanına bir değer eşitleyip kullanmak istiyorum. Daha önce döngülerde yaptığımız gibi kulllanmayacağımız değişkene _ diyebiliriz.


x, _ = (4, 7)


Sol ve Sağdaki Yapı Farklı Sayıdaysa:


x, y, z = (4, 7, 11, 4, 21)



---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-67-483af8373571> in <module>
----> 1 x, y, z = (4, 7, 11, 4, 21)


ValueError: too many values to unpack (expected 3)


  • Bunu gidermek için * yapısını kullanacağız. Aşağıdaki kod şu demek oluyor: İlk iki elemanı x ve y'ye eşitle, sonuna kadar kalan diğer tüm elemanları z'ye eşitle. Bunun sonunda z 11,2,21'den oluşacak, tipi list olacak.


x, y, *z = (4, 7, 11, 4, 21)


x


4


y


7


z


[11, 4, 21]


type(z)


list


  • Diyelim ki ilk 2 'sini eşitleyip kalan hepsini görmezden gelmek istiyorum.


x, y, *_ = (4, 7, 11, 12, 13)


x


4


y


7


  • İlk 2 ve son değeri belirli bir değişkene, arada kalanların hepsini başka bir değişkene eşitlemek istiyorsam:


x, y, *z, t = (4, 7, 11, 4, 21)


x


4


y


7


z


[11, 4]


t


21


  • Aynı şekilde son 2'yi de belirtebiliriz.


x, y, *z, t, u = (4, 7, 11, 4, 21, 32, 2)


z


[11, 4, 21]


t


32


u


2


  • Ama aşağıdaki kod error verir, çünkü y ve t için kaç tane alacağını bilmiyor.


# It will give an error
x, *y, *t = (4, 7, 11, 4)


  File "<ipython-input-96-d7caec8953ac>", line 5
SyntaxError: two starred expressions in assignment


Quiz

Answer the questions to check your understanding.

This lesson includes a short quiz.

Previous
Next

Lesson discussion

Swap insights and ask questions about “Python Temel”.

Enroll to participate
Start the course to unlock the discussion. Enrolling helps us keep conversations relevant to learners.
Cohorts
WebsiteDiscoverBlogPatika.devRise In
CoursesCircleRustSoliditySolanaWeb3 FundamentalsBlockchain Basics
CompanyAbout UsTerms of UsePrivacy PolicyGDPR NoticeCookies
Don't miss any update!

Disclaimer: The information, programs, and events provided on https://cohorts.patika.dev is strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice, nor do we make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://cohorts.patika.dev disclaims any responsibility for financial decisions made by users based on the information provided here.

© 2026 Cohorts, All rights reserved