İçeriğe geç

Python 10 – Dizli-Liste Kullanımı

Python programlama dilinde dizilerin yani listelerin kullanım örneği

liste = ["a","b","c"]
print("Liste =", liste)
liste.append("d")
print("Liste =", liste)
liste.pop(2)
print("Liste =", liste)
liste.insert(2,"c")
print("Liste =", liste)
for i in liste:
    print("Eleman :", i)

sabitListe = ("a","b","c")
print("Sabit Liste =", sabitListe)
print("Listelerin 1. Elemanları =", liste[0], " - ", sabitListe[0])

Farklı bir örnek

matrix = [[1,2,3],[4,5,6],[7,8,9]]
print("Matrix :", matrix)
print("Matrix 2,2 :", matrix[1][1])
matrix[1].append(10)
matrix[1].insert(1,100)
print("Matrix :", matrix)
465 Gösterim  
Tarih:algoritmalar ve programlamaya giriş

İlk Yorumu Siz Yapın

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.

This site uses Akismet to reduce spam. Learn how your comment data is processed.