[Tutor] Theory of computation non-emptiness

Alan Gauld alan.gauld at yahoo.co.uk
Sat Apr 21 18:24:05 EDT 2018


On 21/04/18 12:50, tracey jones-Francis wrote:
> Hi there, I've been working on code 

I've only glanced at this but one thing jumped out at me:


> while queue:
> currentState = queue.pop(0)
> visited.append(currentState)
> #print(visited)
> for a in newAplhabet:
> if (currentState, a) == (newStatesFinal[0], newAplhabet[0]):
> if dic['transitionStates'][0][0] != dic['finalStates'][0] or dic['finalStates'][2]:

This reads to Python like

if X != A or B

which it parses as

if (X != A) or B


Is that what you intended?
It may be the case but, if so, it's a rather cryptic way of
expressing it.


HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list