Algorithms
Logic
def get_nth_words(text, n): return '' if n <= 0 else ' '.join([word for word in text.split()][n - 1::n])
- def get_nth_words(text, n):
if n <= 0:return ""words = text.split()nth_words = [word for word in words[n-1 : : n]]return " ".join(nth_words)- return '' if n <= 0 else ' '.join([word for word in text.split()][n - 1::n])