How to make a list 'count' to 1000
madmonster (33)

First, you have to import random and time.
When you have finished, type in time.sleep(5)
We're using this to prevent a sudden crash.
You should now type in print(list(range(1,1000))) as your final line.
Your program should look like this:

You are viewing a single comment. View All
a5rocks (826)

@Nanashi There are even couple other ways! Let me list a couple :

 def f(x):
  if x == 1000:
    return 1000
  return [x]+list(f(x+1))

[i for i in range(1, 1001)]