Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago