Change the code below by adding another if statement block on line 18 so that drumB...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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() 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()
Expert Answer:
Answer rating: 100% (QA)
To achieve a 33 chance for drumA and a 66 chance for drumB you can modify the code ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Explanation of the technological platforms applied in ERP enterprise resource planning also in CRM consumer relationship management and in ERP business intelligence consumer relationship management....
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
The word culture is used in many ways, such as when people talk about national culture, organisational culture, political culture or youth culture. In which ways do the meanings of culture differ?
-
A flow, 0.2 kg/s dry air, of moist air at 40C, 50% relative humidity flows from the outside state 1 down into a basement where it cools to 16C, state 2. Then it flows up to the living...
-
In 2 0 0 3 , the Lo - Grow Company had $ 1 5 million in equity, a net income of $ 1 , 8 0 0 , 0 0 0 . Lo - Grow paid out 6 0 % of its net income as dividends. The ROE and retained earnings for Lo -...
-
Effects of an Unusual Point. You are analyzing a data set of size \(n=100\). You have just performed a regression analysis using one predictor variable and notice that the residual for the 10th...
-
In teaching this case, a major theme has to be BPs rebranding efforts and how the company must strive to repair its damaged reputation in the wake of the Deepwater Horizon incident. While BP is not...
-
difference between index and index fund difference between uits and eitfs give an example from pakistani market
-
A storage tank is connected to a pond (at atmospheric pressure!) by a length of 3-in pipe and two gate valves. From previous operating experience, it has been found that when the tank is at a...
-
After completing the assigned resources, write a 1-2 page APA formatted paper analyzing 3 skills for effective leadership and discuss why you believe they are effective. Ensure the following points...
-
Under what conditions can an effectuation-based process be more successful than a causation-based process?
-
As CEO of a social media firm (such as Facebook), you have been informed that your firms service will be discontinued in the host country because it allegedly incites social unrest (Egypt and Turkey...
-
What characterizes causation- and effectuation-driven processes, respectively?
-
Discuss the similarities and differences of attitude-based and achievement context models as examples of cognitive motivation theories.
-
Discuss the traits approach to entrepreneurial personality and explain why it fails to properly predict the behaviour of entrepreneurs.
-
As the chief financial officer of Orient Express, you are offered the following two mutually exclusive projects. Cash Flow ($) Year Project A Project B 0 -5,000 -100,000 1 3,500 65,000 2 3,500 65,000...
-
What is the amount of total interest dollars earned on a $5,000 deposit earning 6% for 20 years?
-
Clarita is a single taxpayer with two dependent children, ages 10 and 12. Clarita pays $3,000 in qualified child care expenses during the year. If her adjusted gross income (all from wages) for the...
-
Dr. George E. Beeper is a single taxpayer. He lives at 45 Mountain View Dr., Apt. 321, Spokane, WA 99210. Dr. Beeper's Social Security number is 775-88-9531. Dr. Beeper works for the Pine Medical...
-
Diane is a single taxpayer who qualifies for the earned income credit. Diane has two qualifying children who are 3 and 5 years old. During 2012, Diane's wages are $17,100 and she receives dividend...
-
How can environmental agents that do not cause gene mutations contribute to cancer?
-
With regard to genotypes, what is a true-breeding organism?
-
With regard to biological evolution, which of the following statements is incorrect? Explain why. A. During its lifetime, an animal evolves to become better adapted to its environment. B. The process...
Study smarter with the SolutionInn App