liste = [1, 0, 2, 0, 0] kjor = True while kjor: if liste[0] == 0: liste.remove(liste[0]) if liste[len(liste) -1 ] == 0: liste.remove(liste[len(liste) -1]) if liste[0] != 0: if liste[len(liste) - 1] != 0: kjor = False print(liste)