fork download
  1. structure = [3, 2, 10]
  2. structuretoadd = structure
  3. del structuretoadd[-1]
  4. toadd = []
  5. final = []
  6. for i in structuretoadd:
  7. for k in range(int(i)):
  8. toadd.append(float(k))
  9. toadd.append(1.0)
  10. print(toadd)
Success #stdin #stdout 0.12s 14152KB
stdin
Standard input is empty
stdout
[0.0, 1.0, 2.0, 1.0]
[0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 1.0]