if ......else 和缩进

if else 的例子

sex = input("input yourgender: ")

if sex =="girl": #语法要求加冒号 :
print("i woild like to have a lattel babby") #强制缩进
elif sex =="man":
print("going to homesexaul")
else:
print("pervert!")

语法后边加冒号,缩进必须有条理。

如果出现IndentationError 就是语法错误检查语法


原文地址:https://www.cnblogs.com/PYlog/p/8572956.html