Page 231 - Bilgisayar Bilimi | Kur 1
P. 231
10.15. Dilimleme Örnekleri
Örnek
a=[1,2,3,4,5,6,7,8]
print(‘Prefixes of’,a)
for i in range(0,len(a)+1):
print(‘<’,a[0:i], ‘>’,sep=’’)
print(‘----------------------------------’)
print(‘Suffixes of’,a)
for i in range(0,len(a)+1):
print(‘<’,a[i:len(a)+1], ‘>’,sep=’’)
Ekran Çıktısı
Prefixes of [1, 2, 3, 4, 5, 6, 7, 8]
<[]>
<[1]>
<[1, 2]>
<[1, 2, 3]>
<[1, 2, 3, 4]>
<[1, 2, 3, 4, 5]>
<[1, 2, 3, 4, 5, 6]>
<[1, 2, 3, 4, 5, 6, 7]>
<[1, 2, 3, 4, 5, 6, 7, 8,]>
-----------------------------------
Suffixes of [1, 2, 3, 4, 5, 6, 7, 8]
<[1, 2, 3, 4, 5, 6, 7, 8,]>
<[2, 3, 4, 5, 6, 7, 8,]>
<[3, 4, 5, 6, 7, 8,]>
<[4, 5, 6, 7, 8,]>
<[5, 6, 7, 8,]>
<[6, 7, 8,]>
<[7, 8,]>
<[8,]>
<[]>
230