My code looks like the following:
elif(cmdIn == "repeatultilineString"):
lines = []
currentLine = 0
ask = True
while(ask):
newLine = input("Line " + str(currentLine + 1) + " value(\"end\" to finih line setup): ")
if(newLine == "end"):
ask = False
else:
lines[currentLine] = newLine
currentLine = currentLine + 1
times = input("Input repetition times: ")
interval = input("Input interval(in seconds) between each repetition(0 for quickest repetition): ")
i = 1
while(i<float(times) + 1):
print(str(i) + ":\n")
j = 0
while(j<currentLine):
print(lines[j] + "\n")
j = j + 1
time.sleep(float(interval))
i = i +1
and the output is:
C:\Terminal>>>repeatMultilineString
Line 1 value("end" to finih line setup): hello
Traceback (most recent call last):
File "/home/main.py", line 51, in <module>
lines[currentLine] = newLine
IndexError: list assignment index out of range
Can someone help me fix this?