Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a client/server application using Python to implement a program in which server takes a string as input and then returns the number of characters,

Write a client/server application using Python to implement a program in which server takes a string as input and then returns the number of characters, words and lines in the input string to client.

a) The client inputs from user (a string) and sends it to the server through UDP socket connection

b) The server takes a string as input and then returns the number of characters, words and lines in the input string to client.

Input: This is the "first line" of the string

this is the 'second'

and this is the third

Output: Number of characters = 82

Number of words = 17

Number of lines = 3

Declare a variable that keeps track of whether you are currently reading a word (as oppose to reading a space or newline character) or not. Initialize the variable to reflect that you are currently not reading a word

Item Iterate through the string one character at a time.

Increment the number of characters seen

if the character is a newline character:

increment the number of lines if the character is a newline or a space:

change your state variable to reflect the fact that you are not reading a word

else if you are outside a word:

increment the number of words and change your state reflect that you are inside a word

d) The client then displays the result to the user. And asks users if he wants to perform another count. If Yes, repeat all steps else just terminate.

e) You must provide a command-line interactive interface.

f) Code should be well documented.

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

List some differences between R and Python.

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago