Generation

generate functionThu, 15 Dec 2022

word=['火星','SUN','MOON','タイタン','冥王星'] Output only alphabetic and 4-letter words from this list.

def filter_list(l): alphabetic = [word for word in l if word.isalpha()] four_letter_words = [word for word in alphabetic if len(word) == 4] return four_letter_words filter_list(word)

Questions about programming?Chat with your personal AI assistant