>>> def fib(n):
... result = []
... a, b = 0, 1
... while b<=n:
... result.append(b)
... a, b = b, a+b
... return result
>>> list=[100,fib(100),200,fib(200)]
>>> list
[100, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], 200, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]]
>>> list.append(300,fib(300))
>>> list
[100, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], 200, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144], (300, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233])]
Why are there parenthesis around the appended element?
==============================================================================
Michael Tibbs email: tibbs_michael@si.com
Smiths Industries Aerospace voice: 616-241-7572
4141 Eastern Ave SE FAX: 616-241-7533
Grand Rapids, MI 49518
==========================="OOP is no mistake."===============================