Create an empty list with certain size in Python

How do I create an empty list that can hold 10 elements?

After that, I want to assign values in that list. For example:

xs = list()
for i in range(0, 9):
   xs[i] = i

However, that gives IndexError: list assignment index out of range. Why?

← Назад к списку