#coding: UTF-8 a = [4, 3, 12, 5, 0] for num in a: print "num = " + str(num) print "End, then after sorting" a.append(-2) a.sort() for num in a: print "num = " + str(num) print "End" for str in "Hello": print str print "End" --------------------output----------------------------- num = 4 num = 3 num = 12 num = 5 num = 0 End, then after sorting num = -2 num = 0 num = 3 num = 4 num = 5 num = 12 End H e l l o End