[英]what did I do wrong here? "write a python program that shows the following output"
[英]What do I do wrong here? Python Conditions
它说显然有一个错误。 我很新手,我真的看不出我做错了什么
print(age)
if age>=18
print("you may enter the site")
elif print("no access")```
第一的
您是否将年龄设置为其他地方的变量? 年龄从何而来? 你不能打印不存在的东西。
第二个如果年龄> = '18
你在看一个数字还是一个字符串? 我假设您的意思是 18。“18”和 18 不是一回事。 一个是字符串,另一个是 integer。 您也没有在结尾处使用 ' 来终止字符串。
您的 if 语句格式不正确。 Python 对空格敏感。 if 的语法如下。
if age >= 19:
print("Something")
else:
print("something else")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.