In certain chat programs or messaging applications there is


Question: (a) In certain chat programs or messaging applications, there is a limit on the number of characters that you can send in a message. Write a function that takes as input the message (a string) and checks whether the number of characters is less than 160 (or not). If the length of the message is less than 160, the message should be returned. If the length of the message is greater than 160, a string consisting of only the first 160 characters should be returned.

(b) How would you check if the restriction is on number of words rather than characters? Write a function that allows a message with only 20 words.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: In certain chat programs or messaging applications there is
Reference No:- TGS02476856

Now Priced at $15 (50% Discount)

Recommended (94%)

Rated (4.6/5)