Python:if语句
#!/usr/bin/python
# coding=utf-8
# Filename:iftest.py
num = 23
i = int(raw_input("input a number: "))
if i == num:
print 'right!'
print 'have no prise'
elif i > num:
print 'guess bigger'
else:
print 'guess smaller'
print 'done.'
要点:
if-elif-else
后面要加冒号
靠缩进区分子语句块
raw_input
内置函数参数和返回都为字符串
python中没有switch
语句