Here we use slice again to reduce to a certain element count. This will not add new elements to the end of a list to expand it—we must use append() to do that.
Note In these slice examples, the first argument is omitted because it is implicit. When omitted, a start of zero is assumed.
letters = ["x"
, "z", "a", "b"]
# Resize list to two elements at the start.
letters = letters[:2
['x', 'y', 'z', 'a', 'b']