x = 3my_list = [] for i in range(1, x+1): my_list.append(i) print(my_list)
Standard input is empty
[1] [1, 2] [1, 2, 3]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!