Add "ly" after "ing"
Write a Python program to add “ly” if a string ends with “ing”, otherwise add “ing”.
"winning", "play"
winningly playing
Approach
endswith("ing")decides which suffix to add.
Solution
for word in ["winning", "play"]: print(word + ("ly" if word.endswith("ing") else "ing"))winningly playing
Learn the concept
New to this topic? Read the lesson, then come back.