title: How to replace two elements in a list if both are the same (Python)
body: <p>I want to replace elements in a list if they coincide in the same list untill there is only an 1 in the list. If I have [1,0,1,0,1], the list becomes [0,0,1,0,0] or something like that, only with an 1... but it doesnt replace elements and it prints the same list...</p>
  
  <pre><code> import random 
  
  p = float(input("Introduzca probabilidad de transmisión: "))
  q = 1 - p
  usuarios = ['Usuario1','Usuario2', 'Usuario3', 'Usuario 4', 'Usuario5']
  transmisiones = []
  
  for i in usuarios:
      if random.random() &lt; p:
          transmisiones.append(1)
      else:
          transmisiones.append(0)
  
      print(transmisiones)
  
      for elemento in transmisiones:
          if elemento == 1 and transmisiones[0:5] == 1:
              transmisiones[elemento] = 0
  
  
      print(transmisiones)
  
  
  
  
      output:
  
      Introduzca probabilidad de transmisión: 0.6
      [1, 1, 0, 0, 0]
      [1, 1, 0, 0, 0]
  </code></pre>