python 控制语句

 
 1 for i in range(1,10,2):
 2     print 'my number is ', i
 3     if i == 5:
 4         print 'got it!'
 5         break
 6 else:
 7     print 'class is dismiss'
 8 
 9 
10 while True:
11     input = int(raw_input('input code:'))
12     if input == 5:
13         print 'success'
14     elif input == 0:
15         break
16     elif input > 5:
17         print 'pls try smaller one than ',input
18     else:
19         print 'it close to success,pls try again!'
View Code

 

l = [1, 2, 3, 3, 3]

l = filter(lambda x: x != 3, l)

print l

 

//

 

l = [1, 2, 3, 3, 3]
l=[i for i in l if i!=3]

print l

posted on 2013-09-07 10:18  ukouryou  阅读(110)  评论(0编辑  收藏  举报

导航