Your control flow statements (if/elif/else) all end with return s, so you could restructure things to eliminate the redundant return s statements:
def verbing(s):
if len(s) >= 3:
if s[-3:] == 'ing':
s = s + 'ly'
elif s[:-3] != 'ing':
s = s + 'ing'
return s
This also eliminates the if len(s) < 3 line, since if len(s) isn't greater than or equal to 3, that must mean it is less than 3, so there isn't much of a point in checking for that explicitly.
Similarly, since the if s[-3:] == 'ing' line asks "does this end in -ing? yes or no?", if the answer is not "yes", it must be "no" (or in this case, False). So the elif statement can be replaced with a simpler and more efficient else (more efficient since it's not checking & evaluating another condition). You can also shorten s = s + something statements to s += something, which is a bit shorter and nicer to read:
def verbing(s):
if len(s) >= 3:
if s[-3:] == 'ing':
s += 'ly'
else:
s += 'ing'
return s
Finally, there's a shorter way to write simple if/else statements which in other languages is known as the ternary operator, which applied here would look something like this:
def verbing(s):
if len(s) >= 3:
# the parentheses are not needed but do
# help make it more clear what's going on
s += ('ly' if s[-3:] == 'ing' else 'ing')
return s
This ('ly' if s[-3:] == 'ing' else 'ing') statement gets evaluated in the same way as the previous if/else statement, just written in a different way. It can be read as "this statement should be equal to 'ly' if the string ends in 'ing'; otherwise, this statement should be equal to 'ing'." The value of that statement is what will get tacked onto the end of the string s.
Ultimately, I think the code you began with is a good place to start, since it does in fact work. And you're right to want to review that code to see if there are places where it could be cleaner, shorter, and/or more efficient. This is roughly how I personally go about these sorts of things and I hope this may help you in the process of improving and refactoring the code you write in future. Good luck and have fun!