string - Python output not what i would think will happen (Functional Programming) -
i trying output vowel letters (case typed) of input , pipe thorugh python using "functional programming".
def bob(word): return list(map(lambda x:x in ['a', 'e','i','o','u'], word.lower().strip())) bob('hello') [false, true, false, false, true] although output seen above not expecting. ideas?
becuase of in comments got output looking for.
what worked me adding .lower() x in functional programming style using filter.
def bob(word): return list(filter(lambda x:x.lower() in ['a','e','i','o','u'], word.strip())) this made output view upper case within aloha.
bob('aloha') ['a', 'o', 'a'] thanks guys!
Comments
Post a Comment