i = 0numbers = []while i < 6:? ? print "At the top i is %d" % i????numbers.append(i)? ? i = i + 1? ? print "Number now: ", numbers? ? print "At the bottom i is %d" % iprint "The numbers: "for num in numbers:? ? print num如何將上邊這段while代碼改寫成一個(gè)函數(shù),將測(cè)試條件(i<10)中的10 換成一個(gè)變量。用for loop和range重寫一遍。
添加回答
舉報(bào)
0/150
提交
取消