rozwiazanie zadan Task202, Task203 i Task204

This commit is contained in:
B. Piatek 2020-02-02 17:28:23 +01:00
parent c58a151e84
commit d428ccfa51
3 changed files with 18 additions and 0 deletions

6
automata/Task202.py Normal file
View File

@ -0,0 +1,6 @@
def get_number_of_final_states(automaton):
number_of_states = 0
for state in range(automaton.get_number_of_states()):
if automaton.is_final_state(state):
number_of_states += 1
return number_of_states

6
automata/Task203.py Normal file
View File

@ -0,0 +1,6 @@
def get_number_of_transitions(automaton, symbol):
number_of_transitions = 0
for state in range(automaton.get_number_of_states()):
if automaton.get_target_state(state, symbol) is not None:
number_of_transitions += 1
return number_of_transitions

6
automata/Task204.py Normal file
View File

@ -0,0 +1,6 @@
def get_number_of_loops(automaton, symbol):
number_of_loops = 0
for state in range(automaton.get_number_of_states()):
if automaton.get_target_state(state, symbol) == state:
number_of_loops += 1
return number_of_loops