0

For example, my list is something like this:

frame = [0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0]

Now, I'm working on Hamming's redundancy and i wanted to add something like this (2s are for visibility):

frame or new_frame = [2, 2, 0, 2, 1, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0]

This might be basic but I really can't think of some way, without involving much work on the CPU, to do this smoothly.

Also this has to be done after the first frame is created, by which I mean, I can't add the redundancy bits while creating the frame.

AlG
  • 14,697
  • 4
  • 41
  • 54
BryceSoker
  • 624
  • 1
  • 11
  • 29

1 Answers1

1

there is .insert method of list which allows you to do that https://docs.python.org/2/tutorial/datastructures.html

Alex
  • 1,141
  • 8
  • 13
  • Wait, so the insert method does not replace the value on the index? Holy crap i'm an idiot, i literally just used the function to add the values... Thanks man. – BryceSoker Mar 28 '16 at 15:33