Question: Change the code below by adding another if statement block on line 18 so that drumB is placed on track 2 if drumA fails
Change the code below by adding another if statement block on line 18 so that drumB is placed on track 2 if drumA fails to be added. When Run, there should be a 33% chance for drumA, and a 66% chance for drumB. 1 from random import randint 2 from earsketch import * 3 4 init() 5 setTempo (115) 6 7 lead EIGHT_BIT_ATARI_LEAD_007 8 drumA = EIGHT_BIT_ANALOG_DRUM_LOOP_001 9 drumB = EIGHT_BIT_ANALOG_DRUM_LOOP_008 10 11 insertMedia(lead, 1, 1) 12 13 r = randint(1, 3) 14 15 if r == 1: 16 17 18 19 20 21 finish() insertMedia (drumA, 2, 1) # add if statement block here PYTHON 11 12 13 r = randint(1, 3) 14 15 16 17 insertMedia(lead, 1, 1) 18 19 if r == 1: insertMedia (drumA, 2, 1) # add if statement block here 20 21 finish()
Step by Step Solution
3.47 Rating (150 Votes )
There are 3 Steps involved in it
To achieve a 33 chance for drumA and a 66 chance for drumB you can modify the code ... View full answer
Get step-by-step solutions from verified subject matter experts
