python 程序改错求助

2025-04-01 09:32:18
推荐回答(2个)
回答1:

你的程序在判断首字母为元音时用了不等号,应该用in运算符,

另外,你的程序在首字母为元音退出循环,根据题目要求的运行结果看,不需要用循环.

完整的Python程序如下

n='aeiou'

x=input('Enter a word:')

if x[0] in n:

print(x.upper()+' is vowel word.')

else:

print(x.upper()+' is not vowel word.')

源代码(注意源代码的缩进)

回答2:

python 程序改错求助