[英]How do I fix the indentation error of 4 line?
ch = input("Enter a character: ")
try:
if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I' or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
print(ch, "is a Vowel")
else:
print(ch, "is a consonant")
except TypeError:
print ("Data type error occurred, Please provide any positive number to calculate factorial of it.")
The inside of a try block has to be indented; try 块的内部必须缩进; basically any time a line ends with :
, the next line will need to be indented.基本上任何时候一行以:
结尾,下一行都需要缩进。
ch = input("Enter a character: ")
try:
if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I' or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
print(ch, "is a Vowel")
else:
print(ch, "is a Consonant")
except TypeError:
print ("Data type error occured, Please provide any positive number to calculate factorial of it.")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.