![图片[1]-Python中if else语句出错-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5ee9b099728fa169.jpg)
Python中用if……else语句编写代码,结果出现错误:
源码为:
number=2 ifnumber==2: print("youarefool") else: print("youarebeautiful")
错误提示为:

仔细看了一下,结果是else的缩进发生了错误。
修正后的代码为:
number=2 ifnumber==2: print("youarefool") else: print("youarebeautiful")
运行结果为:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容