python 基础 3 if语句

sex = input("please input your gender:")
if sex == "man":
    print("I would like to makefriend with you")
elif sex == "girl":
    print("I would like have a little monkey with you")
else:
    print("are you kidding me?")
guess sex game

python里面采用强制缩进,来指定作用域。类似于java里面的{}括起来的部分。如果没有缩进的话,python就会语法错误。
python只会认为要执行if下有缩进的那些语句。

posted @ 2018-01-18 21:49  王子之心  阅读(127)  评论(0编辑  收藏  举报