![]() |
Print list from splitted range of numbers - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Print list from splitted range of numbers (/thread-4719.html) |
Print list from splitted range of numbers - prashant8530 - Sep-04-2017 Hi, I want to create a list which contains the number upto a given limit. For eg, if max = 500 the first list should contain the first 100 numbers and then the original should get reset and then it should contain another 100 numbers and so on. Any ideas on how to do this.?? Below mentioned is the code that I used, is there any other efficient way to do this??? min = 1 max = 100 list_one = [] for i in range(min,max+1): list_one.append(i) if len(list_one) >= 10: print(list_one) list_one = [] RE: Print list from splitted range of numbers - ichabod801 - Sep-04-2017 You can just do this with range directly: list_one = list(range(min, max + 1))I'm not sure what you mean by the first list and then resetting the list. |