if statment, for 루프 및 목록을 사용하여이 작업을 실행하려고합니다. 목록은 매개 변수의 일부입니다. 나는 if 문을 쓰는 방법을 모르며 프로그램이 다른 단어들 모두를 통해 루프되도록하고 그것이 어떻게 되야하는지 모든 것을 설정한다. 에 대해 (NO 필요한 경우) 어떤if 문을 사용하여 루프를 실행하려면 어떻게해야합니까?
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
좀 더 구체적으로 알려주세요. 당신의 문제는 무엇이고, 프로그램에서 무엇을 기대합니까? – aIKid
이것은 너무 모호합니다. 이미 실행되지 않습니까? 왜'if','for 루프','list'를 사용해야합니까? 그들을 위해 무엇입니까? 이 '다른 단어들'은 무엇이고 당신은 무엇을 세워야합니까? –
이것은 이미 작동하지만 if 문과 루프 중 하나에이를 압축하려고합니다. for 루프는 모든 다른 범위를 통해 실행되며이 프로그램이 이미 수행 한 작업을 정확하게 수행합니다. –