Dec-03-2020, 12:55 PM
(This post was last modified: Dec-03-2020, 01:14 PM by blazej2533.)
Hello
I want to add an element to the list. I want this element to be on the list under the index as high as this element. If an item is already occupied, I want to add it to the next free item.
w pliku mam słowa, które zmieniam na znaki ASCII
for example input:(after converting)
table = [5,5,7,1,2,3,6]
I want to add an element to the list. I want this element to be on the list under the index as high as this element. If an item is already occupied, I want to add it to the next free item.
w pliku mam słowa, które zmieniam na znaki ASCII
for example input:(after converting)
table = [5,5,7,1,2,3,6]
Output:table[0]=None
table[1]=1
table[2]=2
table[3]=3
table[4]=None
table[5]=5
table[6]=5
table[7]=6
table[8]=7my code:file = open('C:/Users/Błażej/Desktop/znaki.txt', 'r').read()
lines = file.split('\n')
table = []
table2=[]
for line in lines:
lista=list(line)
result=0
for elem in lista:
result+=int(ord(elem))
rozmiar=result%1013
table.append(rozmiar)
table2.insert(rozmiar, rozmiar)
print(table2)
