defformat_words(words):iflen(words)<2:return"".join(words)return", ".join(words[:-1])+" and "+words[-1]words=["ninja","samurai","ronin","leonardo","michelangelo","donatello","raphael"]print(f"{format_words(words)}")words=["alpha","beta"]print(f"{format_words(words)}")words=["alone"]print(f"{format_words(words)}")words=[]print(f"{format_words(words)}")
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python 3