我想通过使用if语句,for循环和列表来运行它。该列表是参数的一部分。我不知道如何编写if语句,并让程序循环遍历所有不同的单词,并设置它应该是什么样的一切。如何使if语句和for循环运行?
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 loop'和'list'?他们是为了什么?这些“不同的词”是什么,你需要设置什么? –
这已经工作,但我想浓缩到一个if语句和一个for循环。 for循环会遍历所有不同的范围,并且完成这个程序已经做的事情。 –