Question: Modify the code below to run the non-deterministic finite automata (NFA) in python with the given graph below: Code: ``` class FA: def __init__(self, alphabet,
Modify the code below to run the non-deterministic finite automata (NFA) in python with the given graph below:

Code:
```
class FA: def __init__(self, alphabet, states, transition, accepting_states): self.alphabet = alphabet self.states = states self.transition = transition self.accepting_states = accepting_states def NFA(input_string, nfa): # set current_state to initial state current_states = nfa.states[code here] # run through the input string for symbol in input_string: x = set() for state in current_states: i = nfa.states.index(state) j = nfa.alphabet.index(symbol) x = code here current_states = x return current_states def main(): # Read in the input_string input_string = input() nfa1 = code here final_states = NFA(input_string, nfa1) if set(final_states) & set(nfa1.accepting_states): print("Accept") else: print("Reject")
if __name__ == "__main__": main()
```
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
