我用while不行?
L=[] i=0 while i<100: i=i+1 L.append(i) print L[6::7] # output [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]
任务:请用for循环迭代数列 1-100 并打印出7的倍数。结果没错只是我没用for循环迭代所以不行吧?
L=[] i=0 while i<100: i=i+1 L.append(i) print L[6::7] # output [7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]
任务:请用for循环迭代数列 1-100 并打印出7的倍数。结果没错只是我没用for循环迭代所以不行吧?
2015-05-28
举报