python的if语句

来源:互联网 发布:排序算法比较 编辑:程序博客网 时间:2024/06/10 15:25
a=[2,3,4]if a[0]>3:    print("this is run")elif a[2]==4:    print "this is four"else:    print "no run"b=(1,2,3,4)if b[0]>2:    print "this is one step"else:    print "this is two step"# output# this is four# this is two step
语法中语句的尾部都加了冒号。这是感觉和C中不同之处。而且条件表达式不用括号。
0 0