lundi 15 mars 2021

I'm trying to solve a problem at codewars using python

So the problem I have is I think that the code is good, but it doesn't work as I would like it to. Make a program that filters a list of strings and returns a list with only your friends name in it.

If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not...

Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"]

The code I wrote:

def friend(x):
    for x in friend:
        split_words = x.split( )
        word_count = len(split_words):
            if word_count = 4:
                print(x)

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire