一、控制流
1、 if ... elif ...else
#!/usr/bin/python
# filename:demoIf.py
no1=int(raw_input("Enter first number"))
no2=int(raw_input("Enter second number"))
if no1==no2:
print "="
elif no1<no2:
print "<"
else:
print ">"
print "over!"
2、while ...else
#!/usr/bin/python
#filename;demoWhile.py
loop=True
while loop:
num=int(raw_input('enter a integer'))
if num<10:
print "continue"
continue
elif num>100:
print "break"
break
else:
loop=False
print "10~100"
else:
print "while over"
3、for ... else(可选) ...
#!/usr/bin/python
#filename:demofor.py
for i in range(1,10,2):
print i
else:
print "loop over"
for i in range(0,10,2):
print i
if i==8:
break
else:
print "loop over"