how to add an item to a list based on length python code example Example: how to add element in list list = [] list.append(var)