python版本:3 若有错误,敬请指出 模块名称:测试.py
#加分习题33
i= 0
numbers = []
while i < 6:
print("At the top i is %d"% i)
numbers.append(i)
i = i + 1
print("Numbers now:",numbers)
print("At the bottom i is %d"% i)
print("The numbers:")
for num in numbers:
print(num)
#1
print("-----------1")
def cycle(num,num2):
i = 0
numbers = []
while i < num:
print("At the top i is %d"% i)
numbers.append(i)
i = i + num2
print("Numbers now:",numbers)
print("At the bottom i is %d"% i)
print("The numbers:")
for numb in numbers:
print(numb)
num = int(input("enter numbers:"))
#3
num2 = int(input("enter numbers2:"))
cycle(num,num2)
#5
print("-----------5")
i = 0
numbers = []
for i in range(0,6):
print("At the top i is %d"% i)
numbers.append(i)
#i += 1 可加可不加
print("Numbers now:",numbers)
print("At the bottom i is %d"% i)
print("...")
for num in numbers:
print(num)
运行截图: