Тэги:
#PythonКомментарии:
this fuqqin error drives me nuts
ОтветитьHas anyone any idea what is wrong with this code (?):
------------------------------------------------
GRID = '30373'\
'25512' \
'65332' \
'33549' \
'35390'
my_list = []
for i in range(0 , len(GRID),5):
my_list.append(GRID[i:(i+5)])
total = 0
for i in range(5):
for j in range(5):
if my_list[i][j] > my_list[i][:j] or my_list[i][j] > my_list[i][j:]or my_list[i][j] > my_list[i:][j]:
print(i , j)
total += 1
---------------------------------------------------
if my_list[i][j] > my_list[i][:j] or my_list[i][j] > my_list[i][j:] or my_list[i][j] > my_list[:i][j] or my_list[i][j] > my_list[i:][j]:
~~~~~~~~~~~^^^
IndexError: list index out of range
---------------------------------------------------
Thanks men you explained it very clearly😇😇😇😇🤗🤗🤗🤗👍👍👍👍👍
ОтветитьСпасибо большое!
ОтветитьArray of Nth terms how would you manage this error????
ОтветитьJe n'arrive pas à résoudre l'erreur : 'index list out of range', pourriez-vous m'aider.
Voici mon code:
liste_comp_pb = [] # Couleur déjà compté
liste_comp_pr = [] # Pion rouge déjà compté
# Calcul des pions rouges
for i in range(len(listeP1)):
if listeP1[i] == listeP2[i]:
pion_rouge += 1
liste_comp_pr.append(i)
for i in range(len(listeP2)):
if listeP1[i] != listeP2[i]:
listeP1_copie = listeP1[:]
del listeP1_copie[i]
if listeP2[i] not in liste_comp_pb:
if listeP2[i] in listeP1_copie:
pb = True
for j in range(len(liste_comp_pr)):
print(f'\n\nj={j}\n{liste_comp_pr[j]}\n{liste_comp_pr}\nlisteP1_copie[j] : [{liste_comp_pr[j]}],{listeP1_copie[liste_comp_pr[j]]}\nlisteP2[i] [{i}],{listeP2[i]}')
if listeP2[i] == listeP1_copie[j]:
pb = False
break
if pb:
pion_blanc += 1
liste_comp_pb.append(listeP2[i])
Thanl you!
ОтветитьNice, and how you mange that in Kodi Sportowa Addon?
Ответитьlist = ['Alice', 'Johnson', 'Jack']
print(list[0])
Output:
Alice
I think it would be clearer to specify that you need to use the print function, so newbies don't confused.
Initially, I was doing this. I kept getting null.
list = ['Alice', 'Johnson', 'Jack']
list[0]
I have proplem:
If u said
A is input
A = "aafgh fgjjj dhjkk fjkkv"
How could i print A.split(" ")[5] if it's exist