def count_for_me(start=None, step=None):
if not start:
start = int(input('Start number?: '))
if not step:
step = int(input('Steps between each iteration?: '))
return tuple(abs(x) if start > 0 else x for x in range(start if start < 0 else -start, 0, step))
print count_for_me()
print len(count_for_me())
这是我解决你问题的方法,希望对你有帮助!你知道吗
将返回每个值的列表。 我没有包括任何错误检查,以确保用户键入了正确的值;没有浮点数,只有正整数的步骤等。。。你知道吗
相关问题 更多 >
编程相关推荐