Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
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))
question
212))
212)) print (sms_format(kevin
def sms_format(message