Hello,<br><br>I'm a new bie to python programming and on the processing of learning python programming. I have coded my first program of fibonnaci generation and would like to know if there are better ways of achieving the same.<br>
<br>I still feel quite a few things to be improved. Just wanted experts thoughts on this.<br><br>try:<br> <br> length = input('Enter the length till which you want to generate the fibonnaci series: \n')<br> print type(length)<br>
<br>except:<br> print 'Invalid input detected'<br> exit(0)<br><br>if type(length) is int: <br> result = []<br> a = 0<br> b = 1<br> result.append(a)<br> result.append(b)<br> if length > 2:<br>
count = 2<br> while count < length: <br> c = a + b<br> a = b<br> b = c<br> result.append(c)<br> count += 1<br> else:<br> print result<br>
print 'The lenght of result is : ' , len(result)<br> else:<br> print 'Fibonacci series could not be generated !!!'<br>