Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ntroxIntroduction to Program X C Search Tutors Chegg.co x k.html#_carsketch-asg-

ID: 3739793 • Letter: N

Question

ntroxIntroduction to Program X C Search Tutors Chegg.co x k.html#_carsketch-asg-82 oping Through a F This exercise loads the clipAndMeasures.txt file below using the importFile0 function. clipAndMeasures.txt file HIPHOP DUSTYGRO0VE 018:1:7 HIPHOP DUSTYMOOG_001:2:7 HIPHOP_DUSTYGUITAR_001:4:7 Modify the code below to use a for loop to add all the lines from the file on separate tracks. 1 from earsketch import * init( 4 setTempo (100) 6 fileDataimportFile("http:/learsketch.gatech.edu/itec2120/data/clipAndMeasures.txt") 8 lines fileData.split("In") 10 # replace the code below with a for loop that adds all the lines on separate tracks 1 track 1 2 first line lines[0] 13 values first line.split("") 14 clip values [0] 15 start -int(values [1]) 16 endint (values [2]) 17 fitMedia(clip, track, start, end) 18 19 finish) EFFECTS 00:01 0002 0003 00:04 0005 00:06 HIPHOP,DUSTYGU TA 001 HPHOP DUSTYGUITAR 001

Explanation / Answer

from earsketch import *

init()

setTempo(100)

fileData=importFile("http://earsketch.gatech.edu/itec2120/data/clipAndMeasures.txt")

lines=fileData.split(" ")

for i in range(len(lines)):

track = i+1

first_line=lines[i]

values=first_line.split(";")

clip=values[0]

start=int(values[1])

end=int(values[2])

fitMedia(clip,track,start,end)

finish()