Question: 4. dfa.py: Write a program that reads a description of a deterministie finite automaton (DFA) and then classifies input strings as accepted or rejected by
4. dfa.py: Write a program that reads a description of a deterministie finite automaton (DFA) and then classifies input strings as accepted or rejected by the DFA DFAs are characterized by the following 5-tuple: (Q 6,9s, F), where Q denotes the set of states. is the alphabet of posible input symbols, is the set of transition rales, o is the start state, and F is the set of final (accepting) states. Input to the program will he a DFA specification followed by a number of input strings. For each input string,you should print accepted" or rejected" Example DFA start Go 92 Corresponding input, cluding input test strings begin rules go -q1 on a q1 42 on b go q2 on c qi-qi on a qo - q3 on b end_rules start: q0 final: q2 3 ab prints"accepted" eba #printa.rejected" aaa # prints"rejected" aaab prints "accepted" 4. dfa.py: Write a program that reads a description of a deterministie finite automaton (DFA) and then classifies input strings as accepted or rejected by the DFA DFAs are characterized by the following 5-tuple: (Q 6,9s, F), where Q denotes the set of states. is the alphabet of posible input symbols, is the set of transition rales, o is the start state, and F is the set of final (accepting) states. Input to the program will he a DFA specification followed by a number of input strings. For each input string,you should print accepted" or rejected" Example DFA start Go 92 Corresponding input, cluding input test strings begin rules go -q1 on a q1 42 on b go q2 on c qi-qi on a qo - q3 on b end_rules start: q0 final: q2 3 ab prints"accepted" eba #printa.rejected" aaa # prints"rejected" aaab prints "accepted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
