Question:
# using range function
def listWithStep(startValue,endValue,step):
for i in range(startValue + step,endValue + step,step):
print(i)
return 0
# using while loop
def listWithStep_while(startValue,endValue,step):
i = start
while (i < endValue and step >= 0) or (i > endValue and step < 0):
i += step
print(i)
return 0
# main
if __name__ == "__main__":
start = int(input("PLEASE INPUT START VALUE\n"))
end = int(input("PLEASE INPUT END VALUE\n"))
step = int(input("PLEASE INPUT STEP\n"))
print("*----------using range function----------*")
listWithStep(start,end,step)
print("*----------using while loop----------*")
listWithStep_while(start,end,step)
pass
来源:CSDN
作者:好名字能让你的朋友们更容易记住你
链接:https://blog.csdn.net/ErwinLsy_y/article/details/104553600
