print("Welcome to the Age Classifier program")
person_age=(float(input("Enter the person's Age"))
if person_age<=1 or person_age>0:
print("Person is an infant")
elif person_age>1 or person_age<13:
print("Person is a child")
elif person_age>=13 or person_age<20:
print("Person is a teenager")
elif person_age>=20 :
print("Person is an adult")
else:
print("Person has not been conceived or is developing in the womb")
当我执行这段代码,解释报告说,没有对if
陈述的身体一号线错误,有消息报道说语法是无效的。我尝试添加括号并遇到相同的语法错误。年龄分类的Python程序
在这种情况下,即使输入为'-1',输出也会是''人是婴儿''。 –