Following code snippet appends only the latest value to the list. How to append the complete set of values?
seq = [0, 1]
for n in range(2, 7):
X = 2*seq[n - 1] + seq[n - 2]
seq.append(X)
for num in seq:
print(seq[num])
Using this for-loop you can append the complete set of values.
for num in range(0,len(seq)):
print(seq[num])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.