-1
alovega
5y

I have been given this Task am kind like in a wall:
Your task is to develop a function that takes in a string message and returns an array of string messages with pagination if needed. For this exercise, the maximum number of characters in the input message is 160. Also, do not break words into syllables and hyphens.

my function still break words how can I satisfy this functionality?

this is the python function:

def sms_format(message, size):
sms_text = []
if len(message) == 0:
return sms_text

text = list(message)

if len(text) <= size:
new_text = ''.join(text)
sms_text.append(new_text)

elif len(text) > size:
while len(text)>size:
texts = ''.join(text[:size])
sms_text.append(texts)
text = text[size:]

sms_text.append(''.join(text))

return(sms_text)

message = "Your task is to develop a function that takes in a string message and returns an array of string messages with pagination if needed. For this exercise, the maximum number " \
"of characters in the input message is 1440. Also, do not break words into syllables and hyphens"

kevin = ""

print(sms_format(message, 212))

print (sms_format(kevin,212))

Comments
Add Comment