I just learnt how to remove something from a list
.
rando = keywords[random.randint(0, 14)]
h = 0
for h in range(len(keywords)):
if rando == keywords[h]:
position = h
realAns = definitions[position]
del keywords [h]
However, as I am using a while
loop, a part of the code keeps repeating, and as I have changed the range by deleting an element, a traceback error occurs saying that it is out of range. How do i fix this?
Thanks :)