Python中用if……else语句编写代码,结果出现错误:
源码为:
number = 2 if number == 2: print("you are fool") else: print("you are beautiful")
错误提示为:
仔细看了一下,结果是else的缩进发生了错误。
修正后的代码为:
number = 2 if number == 2: print("you are fool") else: print("you are beautiful")
运行结果为:
Python中用if……else语句编写代码,结果出现错误:
源码为:
number = 2 if number == 2: print("you are fool") else: print("you are beautiful")
错误提示为:
仔细看了一下,结果是else的缩进发生了错误。
修正后的代码为:
number = 2 if number == 2: print("you are fool") else: print("you are beautiful")
运行结果为:
© 2021 Python学习网 苏ICP备2021003149号-1