Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/Temel Python Objeleri ve Veri Yapıları/Videolardaki Notebooklar/Listeler.ipynb
765 views
Kernel: Python 3
liste = ["Elma",35,"Merhaba",3.14,5]
type(liste)
list
liste = [] liste
[]
liste = list()
liste
[]
liste2 = [1,2,3,4,5,6,7,8,9] len(liste2)
9
liste = list("Merhaba") liste
['M', 'e', 'r', 'h', 'a', 'b', 'a']
len(liste)
7
liste1 = [1,2,3] liste2 = [4,5,6] liste3 = liste1 + liste2 liste3
[1, 2, 3, 4, 5, 6]
liste1 * 3
[1, 2, 3, 1, 2, 3, 1, 2, 3]
liste1
[1, 2, 3]
liste1 = liste1 * 3 liste1
[1, 2, 3, 1, 2, 3, 1, 2, 3]
a = "Murat" a[1] = "p"
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-9-8a91b65a69a7> in <module>() 1 a = "Murat" ----> 2 a[1] = "p" TypeError: 'str' object does not support item assignment
liste2
[4, 5, 6]
liste2[1] = 10
liste2
[4, 10, 6]
liste = [1,2,3,4,5,6] liste[:2]
[1, 2]
liste[:2] = [10,11]
liste2
[4, 10, 6]
liste
[10, 11, 3, 4, 5, 6]
liste
[10, 11, 3, 4, 5, 6]
liste.append("Python")
liste
[10, 11, 3, 4, 5, 6, 'Python']
liste.append(12)
liste
[10, 11, 3, 4, 5, 6, 'Python', 12]
liste
[10, 11, 3, 4, 5, 6, 'Python', 12]
liste.pop()
12
liste
[10, 11, 3, 4, 5, 6, 'Python']
liste.pop(0)
10
liste
[11, 3, 4, 5, 6, 'Python']
liste = [34,2,1,5,6,32,100] liste.sort()
liste
[1, 2, 5, 6, 32, 34, 100]
liste.sort(reverse = True)
liste
[100, 34, 32, 6, 5, 2, 1]
liste = ["Php","Python","Java","C"] liste.sort()
liste
['C', 'Java', 'Php', 'Python']
liste.sort(reverse = True)
liste
['Python', 'Php', 'Java', 'C']
liste = [1,2,3,4,5,6] liste[50]
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-35-9db80a335226> in <module>() 1 liste = [1,2,3,4,5,6] ----> 2 liste[50] IndexError: list index out of range
liste = [[1,2],[3,4],[5,6]] liste
[[1, 2], [3, 4], [5, 6]]
liste[1]
[3, 4]
liste[1][1]
4