Invalid syntax on VERY SIMPLE Python if … else statement

后端 未结 7 1827
走了就别回头了
走了就别回头了 2021-01-13 20:05

Can someone explain why I am getting an invalid syntax error from Python\'s interpretor while formulating this simple if...else statement? I don\'t add any tabs myself I sim

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 20:35

    Click to open image

    The problem is indent only.

    You are using IDLE. When you press enter after first print statement indent of else is same as print by default, which is not OK. You need to go to start of else sentence and press back once. Check in attached image what I mean.

提交回复
热议问题