Answers for "how to implement dfa in python"

0

how to implement dfa in python

dfa = {0:{'0':0, '1':1},
       1:{'0':2, '1':0},
       2:{'0':1, '1':2}}
def accepts(transitions,initial,accepting,s):
    state = initial
    for c in s:
        state = transitions[state][c]
    return state in accepting
Posted by: Guest on September-12-2021

Code answers related to "how to implement dfa in python"

Python Answers by Framework

Browse Popular Code Answers by Language