CSCA08H3 Study Guide - Midterm Guide: Iterator, Empty String

89 views6 pages
16 Oct 2018
School
Course
Professor

Document Summary

Create a new sound object of the same length as our predefined variable, If the left channel and right channels are equivalent, proceed to line 3. Print out the index of that sample that resides with Iterate through the samples in the sound object Print the left channel of that sound sample for samp in snd: for samp in snd: print sound. get_left(samp) if sound. get_left(samp) == sound. get_right(samp): print sound. get_index(samp) The original version of the function modifies the parameter snd instead of making a copy and returning a new sound. Since the function requires a different sound object that is a modified version of , we cannot simply modify and return it. Explanation new_snd = sound. copy(snd) # new line for samp in new_snd: # edited line return new_snd: # edited line. Create a new sound object that is a copy of