I'm having difficulty realizing why is this part of code
for stanje in pomocna:
for znak in abcd:
novi = tablicaPrijelaza.get((stanje, znak))
dohvatljiva_stanja.append(novi)
dohvatljiva_stanja = list(set(dohvatljiva_stanja))
dohvatljiva_stanja = sorted(dohvatljiva_stanja)
pomocna = dohvatljiva_stanja
not done x
times with this implementation of a for that does x iterrations
Yet it seems that it does an endless loop. One iterration is fine and does what it is supposed to, but after first iterration it goes nowhere Traceback says it is stuck in second append.
Proper implementation is something more like this which works:
for stanje in dohvatljiva_stanja:
for znak in abcd:
novi=tablicaPrijelaza.get((stanje,znak))
if novi:
pomocna.append(novi)
dohvatljiva_stanja.extend(pomocna)
dohvatljiva_stanja=list(set(dohvatljiva_stanja))
dohvatljiva_stanja=sorted(dohvatljiva_stanja)
del pomocna[0:len(pomocna)]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.