DEV Community

Mustafa  Çam
Mustafa Çam

Posted on

comprehension in python

liste = [1, 2, 3, 4, 5]

liste_carpilmis = [x * 2 for x in liste]

print(liste_carpilmis)
Enter fullscreen mode Exit fullscreen mode

Bu kod, liste adlı listenin içindeki her bir elemanı 2 ile çarpar ve yeni bir liste olan liste_carpilmis içine bu çarpılmış değerleri ekler. Sonuç olarak, liste_carpilmis içindeki elemanlar, liste içindekilerin iki katı olacaktır. Yukarıdaki kod örneği çıktı olarak [2, 4, 6, 8, 10] verecektir.

Bu işleme comprehension denir.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay