How would make this run with an if statement and one for loop?

Posted by Nick Jacobs on Stack Overflow See other posts from Stack Overflow or by Nick Jacobs
Published on 2013-10-04T23:14:09Z Indexed on 2013/10/22 9:55 UTC
Read the original article Hit count: 230

Filed under:

I'm trying to get this to run by using an if statment, a for loop, and a list. The list is part of the parameters. I am not sure how to write the if statement and have the program loop through all of the different words and set everything how it is supposed to be.

newSndIdx=0;
  for i in range (8700, 12600+1):
    sampleValue=getSampleValueAt(sound, i)
    setSampleValueAt(newSnd, newSndIdx, sampleValue)
    newSndIdx +=1

  newSndIdx=newSndIdx+500
  for i in range (15700, 17600+1):
    sampleValue=getSampleValueAt(sound, i)
    setSampleValueAt(newSnd, newSndIdx, sampleValue)
    newSndIdx +=1

  newSndIdx=newSndIdx+500    
  for i in range (18750, 22350+1):
    sampleValue=getSampleValueAt(sound, i)
    setSampleValueAt(newSnd, newSndIdx, sampleValue)
    newSndIdx +=1

  newSndIdx=newSndIdx+500    
  for i in range (23700, 27250+1):
    sampleValue=getSampleValueAt(sound, i)
    setSampleValueAt(newSnd, newSndIdx, sampleValue)
    newSndIdx +=1

  newSndIdx=newSndIdx+500    
  for i in range (106950, 115300+1):
    sampleValue=getSampleValueAt(sound, i)
    setSampleValueAt(newSnd, newSndIdx, sampleValue)
    newSndIdx+=1

© Stack Overflow or respective owner

Related posts about python