Now, the thing is that I am supposed to take an unknown amount of input from the user like on one run he can enter 10 terms on another run he can enter 40. And I cannot ask user initially to enter the value of n so that I can run a range loop and start storing the input in list. If somehow I can do this then for that I have created the loop but that is not the case. So, the question is how to define the endpoint for user? or how to pass unknown number of arguments to the function?
def fibi(n):
while n<0 or n>=50:
print "Enter value of n greater than 0 but less than 50"
n = int(raw_input())
if n==0:
return n
else:
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
main calling function starts
n =[]
????
//This loop is for calling fibi function and printing its output on each diff line
for i in n:
print (fibi(n[i]))
Sample Input:each entry should be on a new line
1
2
3
4
5
.
.
.
n
Sample Output
1
1
2
3
5
python myprog.py 1 2 3 4 5 6 7
much cleaner than questions embedded in the output. Then you can use the other sys.argv comments here. – Gerontocracy