Check presence of vowels in a string

前端 未结 6 1110
温柔的废话
温柔的废话 2020-12-02 01:54

I need to check whether a vowel is present in a word. If it is, an operation should be carried out on the word say op(word). I want to avoid a for loop because

6条回答
  •  情歌与酒
    2020-12-02 01:57

    You can avoid the for loop using a set intersection

    if set('aeiou').intersection(word.lower()):
    

提交回复
热议问题