functions are already provided. The first function is done. need help with other 2.
QUIZ 1 COMP9021 PRINCIPLES OF PROGRAMMING $ python3 ... >>> from quiz_1 import * >>> transitions_1 = ('q0', 0): 'q1', ('q1', 1): 'q0' >>> describe_automaton(transitions_1) When in state "q0" and processing "0", automaton's state becomes "q1". When in state "q1" and processing "1", automaton's state becomes "q0". >>> transitions_2 = ('state_1', 0): 'state_2', ('state_1', 1): 'state_1',\ ... ('state_2', 0): 'state_1', ('state_2', 1): 'state_2' >>> describe_automaton(transitions_2) When in state "state_1" and processing "0", automaton's state becomes "state_2". When in state "state_1" and processing "1", automaton's state becomes "state_1". When in state "state_2" and processing "0", automaton's state becomes "state_1". When in state "state_2" and processing "1", automaton's state becomes "state_2". >>> transitions_as_dict(['q0,0:q1', 'q1,1:q0']) ('q0', 0): 'q1', ('q1', 1): 'q0' >>> transitions_as_dict(['state_1,0:state_2', 'state_1,1:state_1',\ ... 'state_2,0:state_1', 'state_2,1:state_2']) ('state_1', 0): 'state_2', ('state_1', 1): 'state_1', ('state_2', 0): 'state_1', ... ('state_2', 1): 'state_2' >>> accepts(transitions_1, '00', 'q0', 'q1') False >>> accepts(transitions_1, '2', 'q0', 'q0') False >>> accepts(transitions_1, '0101010', 'q0', 'q0') False >>> accepts(transitions_1, '01010101', 'q0', 'q0') True >>> not accepts(transitions_1, '01', 'q0', 'q1') and\ .... accepts(transitions_1, '010', 'q0', 'q1') True >>> accepts(transitions_2, '011', 'state_1', 'state_1') False >>> accepts(transitions_2, '001110000', 'state_1', 'state_1') True >>> accepts(transitions_2, '1011100101', 'state_1', 'state_1') True >>> accepts(transitions_2, '10111000101', 'state_1', 'state_1') False Date: Trimester 1, 2019.