Question: In python, using this coding skeleton: def get_ch(): # prompt for the input in a loop ch = input(Enter a character or press the Return

In python, using this coding skeleton:

def get_ch(): # prompt for the input in a loop ch = input("Enter a character or press the Return key to finish: ") # in case of invalid input, print the following error message print("Invalid input, please try again.") # return the ch at the end def find_state(state, ch): pass def main(): print("I can recognize if you are laughing or not.") print("Please enter one character at a time.") # initialize the variables, for example: string = "" # call the functions in a loop # when user enters an empty string, you should print the results print(" You entered", string) print("You are laughing.") print("You are not laughing.") main() 

Complete this task:

In python, using this coding skeleton: def get_ch(): # prompt for the

Finite State Machine or FSM is also called Finite State Automata. A Finite State Machine is a popular tool that is widely used in computer science. Why it is so popular? Because it is simple, and easy to understand and implement. Here is a brief introduction: http://cs.union.edu/~striegnk/courseslp-with-prolog/htmlode2.html Your task is to implement an FSM that can recognize simple patterns of strings such as: ha! haha! hahaha! ho! hoho! hohoho! hahohoho! hahohahoha! Basically, the pattern to be recognized is a sequence of "ha" or "ho", or a mixture of both. The sequence can be of any length (at least greater than three, i.e., the shortest sequence is "ha!" or "ho!"). There is no restriction on how many "has or "ho"s the sequence can contain, and the "ha"s and "ho's can appear in any order if the sequence is a mixture of both. The string must end with one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!