i = []
for data in range(1,101):
i.append(data)
for data in range(101,201):
i.append(data)
print(i)
This code [[1,2,3,4,5,6,7....100],[101,102,103,200] I want to save it in this way, but what should I do?
python
Performance, when viewing memory utilization
>>> i = [range(1, 101), range(101, 201)]
>>> print(i[1][50])
151
It's better to do it with
i = [[],[]]
for data in range(1,101):
i[0].append(data)
for data in range(101,201):
i[1].append(data)
print(i)
After declaring this two-dimensional list, How about making it like append to element 0 and append to element 1?
© 2024 OneMinuteCode. All rights reserved.