Python  anti_vowel

define a function called anti_vowel that takes one string,text ,as input and returns the text with all of the vowels removed.
Make sure to remove lowercase and uppercase vowels.

Hint:
to check to see if c is a vowel,you can do: c in "aeiouAEIOU"

def anti_vowel(text):
new_text = ""
for w in text:
if w not in "aeiouAEIOU":
new_text += w
return new_text

def anti_vowel(text):
for p in "aeiouAEIOU":
text = text.replace(p,"")
return text

第二种没学过,是在问答里找到的

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容