Unit 3 Sections 14 and 15
During this lesson sections 8 and 10 will discuss lists and iteration
Learning Objective
To be able to select appropriate libraries and/or existing code to use in the creation of new programs.
College Board Essential Knowledge
- A software library contains procedures that can be used in the creation of new programs.
- Existing segments of code can come from internal or external sources, ie. libraries or previously written code.
- The use of libraries simplifies the task of creating complex programs.
- Application program interfaces (APIs) are specifications for how the procedures in a library behave and can be used.
- Documentation for a library or API is necessary in understanding the key behaviors provided by the API/library and how to utilize them in your work.
Defining a Library
- A library is a collection of code from an external source that can be used to add functionality to a program.
- Libraries are very useful, as they can be used to save time and effort in the development process.
- Libraries are usually included in a program using a special keyword called " ." This keyword tells the program to look for the library and use its code.
Why isn't the answer B?
- This because when you are saying equal to 50, you are saying only when this one number shows up the output will be yes.
- You want it to come up 50 percent of the time not just when that one number shows up.
Hacks 3.15.2
- For your hacks you need to create a random number generator that will simulate this situation:
-
There is a spinner divided into eight equal parts. 3 parts of the spinner are green, two parts are blue, one part is purple, one part is red, and one part is orange. How can you simulate this situation using a random number generator.
-
Also answer this question: What numbers can be outputted from RANDOM(12,20) and what numbers are excluded?
Hacks Summary
Hacks 3.14.1
- Write a program that uses a library/libraries in any sort of manner.
- Explain your work/code
Hacks 3.15.1
-
Write a few lines of code that implements the import function
-
Define what an import random function do
-
List a few other things that we can import other than random
Hacks 3.15.2
- For your hacks you need to create a random number generator that will simulate this situation:
-
There is a spinner divided into eight equal parts. 3 parts of the spinner are green, two parts are blue, one part is purple, one part is red, and one part is orange. How can you simulate this situation using a random number generator.
-
Also answer this question: What numbers can be outputted from RANDOM(12,20) and what numbers are excluded?