gpt4 book ai didi

Python代码学院: Making a list with a string

转载 作者:太空宇宙 更新时间:2023-11-03 18:49:07 24 4
gpt4 key购买 nike

我正在考虑是否可以将这行代码转换为所有这些元音的列表;

if first== 'a' or first =='e' or first == 'i' or first == 'o' or first =='u':"

我在想str[a,e,i,o,u]

pyg = 'ay'
first = original[0]
original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original.lower()
if first== 'a' or first =='e' or first == 'i' or first == 'o' or first =='u':
print "vowel"
else:
print "consonant"
else:
print 'empty'


word = original

最佳答案

if first.lower() in ['a','e','i','o','u']:
print "vowel"
else:
print "consonant"

我认为您要查找的单词 (Beuller) 是 bool

关于Python代码学院: Making a list with a string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18777193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com