#all leter are MAG
#E->3 A->4 O->0 V->W I->2
#rand ASCII with ch
from random import randint
letterNum=randint(4,8)
word=[]
if len(word)==0:
faseLetter=chr(randint(65,90))
word[0]=faseLetter
voc=['A','E','O','U','Y','I']
for i in range (letterNum+1):
firstLetter=word[letterNum]
randomChangeMaker=randint(1,2)
if firstLetter in ['A','E','O','U','Y','I']:
faseLetter=chr(randint((66,68),(70,72),(74,78),(80,88),(90)))
if faseLetter == 'W' and randomChangeMaker == 2:
faseLetter='V'
else:
faseLetter=chr(randint(65,90))
if faseLetter == 'E' and randomChangeMaker == 2:
faseLetter='3'
elif faseLetter == 'A' and randomChangeMaker == 2:
faseLetter='4'
elif faseLetter == 'O' and randomChangeMaker == 2:
faseLetter='0'
elif faseLetter == 'V' and randomChangeMaker == 2:
faseLetter='W'
elif faseLetter == 'W' and randomChangeMaker == 2:
faseLetter='V'
elif faseLetter == 'I' and randomChangeMaker == 2:
faseLetter='2'
word=word+faseLetter
print(word)
that's my code and I'm getting this error(I'm using replit.com editor)
Traceback (most recent call last): File "main.py", line 10, in word[0]=faseLetter IndexError: list assignment index out of range
Aucun commentaire:
Enregistrer un commentaire