范围作为 python 中的输入

range as input in python

这是斐波那契数列的简单程序。它 运行 非常适合固定范围。但我想知道是否有可能将范围作为输入?如果是这样,请告诉我获取范围作为输入的语法。

xx=0

x=float (raw_input("enter the starting number:"))

r1=xx+x

print r1

r2=r1+x

print r2

r3=r1+r2

print r3

for i in range(10):

     r4=r2+r3

     print r4

     r2=r3

     r3=r4

"""寻找答案"""

按照您要求的起始编号进行操作:

number_of_outputs = int( raw_input('Enter the number of outputs: '))

#Your code goes here

for i in range(number_of_ouputs):

    #More code goes here