
Sequencing, selection, and iteration | AP CSP (article) | Khan Academy
Iteration: Algorithms often use repetition to execute steps a certain number of times or until a certain condition is met. We can add iteration to the previous algorithm to translate a complete phrase, so …
Sequencing, selection, and iteration | AP CSP (article) | Khan Academy
Sequencing is the sequential execution of operations, selection is the decision to execute one operation versus another operation (like a fork in the road), and iteration is repeating the same operations a …
Sequencing, selection, and iteration - AP CSP (practice) | Khan Academy
Practice using the building blocks of algorithms (sequencing, insertion, and selection), in this set of free practice questions designed for AP Computer Science Principles students.
Procedures with parameters | AP CSP (article) | Khan Academy
In the examples above, we've been passing literal strings and number values as the parameters, like "Sally" and 27. We can actually pass any programatic expression that evaluates to a value, like a …
Recursion (article) | Recursive algorithms | Khan Academy
Recursion has many, many applications. In this module, we'll see how to use recursion to compute the factorial function, to determine whether a word is a palindrome, to compute powers of a number, to …
AP CSP Example: Iterating through array with for loop | Khan Academy
A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ...
The scientific method (article) | Khan Academy
As an example, suppose we have the hypothesis that all apples are red, and we test this hypothesis by examining a group of ten apples and seeing what color they are.
Review: Arrays (article) - Khan Academy
It prevents an infinite loop. Here's an example: while (i < 5) { text ("Hello world!", 30 + i * 20, 100); i++; } What "i" does here, is it limits the text to appearing 5 times. (You can also use it to control a …
Data records (article) | Nested data: lists | Khan Academy
To construct the dictionary, we iterate over the dataset. On each iteration, we access the "condition" field for the current forecast record. Then, we increment the count for that condition. If the condition …
Dictionary iteration patterns (article) | Khan Academy
We start our iteration with an empty list and append any species names that contain the given word. In this case, our function call passes in the word "deer", so we collect all the deer species. However, we …