The general functions like Program 108 are the kind where the index array notation is really useful. Write reverse, copy, and clip using index array notation.
What will be an ideal response?
```
def reverse2(source):
target = makeEmptySound(getLength(source))
targetSamples = getSamples(target)
sourceSamples = getSamples(source)
for sourceIndex in range(0,getLength(source)):
sourceValue = getSampleValue(sourceSamples[sourceIndex])
setSampleValue(targetSamples[getLength(source)-1-sourceIndex] ,sourceValue)
return target
def copy2(source,target,start):
targetIndex = start
sourceSamples = getSample(source)
targetSamples = getSample(target)
for sourceIndex in range(0,getLength(source)):
sourceValue = getSampleValue(sourceSamples[sourceIndex]) setSampleValue(targetSamples[targetIndex] ,sourceValue) ' targetIndex = targetIndex + 1
def clip2(source,start,end):
target = makeEmptySound(end - start)
sourceSamples = getSamples(source)
targetSamples = getSamples(target)
for targetIndex in range(0 ,getLength(target)):
sourceValue = getSampleValue(sourceSamples[start+targetIndex]) setSampleValue(targetSamples[targetIndex] ,sourceValue) return target
```
You might also like to view...
The unauthorized use of your neighbor's wireless network is called trolling
Indicate whether the statement is true or false
Besides crime, what are some other beneficial aspects of surveillance in a modern society?
What will be an ideal response?
The IP address 192.168.5.5 is a private IP address according to RFC 1918
Indicate whether the statement is true or false.
Which section break begins a new section on the same page?
A. Continuous B. Even page C. Odd page D. Same page