Unit 2. Developing Programming ToolsRevision Date: Jun 11, 2020 (Version 3.0)
This is the second session on algorithms
During the second session, the students will use pseudocode to describe an algorithm.
Students will write pseudocode using sequencing, selection, and iteration constructs.
Student computer usage for this lesson is: optional
Files in the Lesson Resources folder:
AlgorithmsPseudocode2.pptx : PowerPoint Slides for mini-lectures
Student Handout and Key for Matching Pennies Game
Student Handout for Rock Paper Scissors
Psuedocode Summary and Examples of common Algorithms.docx
Journal: Describe the algorithm of another student. Is there enough detail to allow somebody to follow the steps?
Walk through “Selection Statements”; “Iteration / Repetition” slides from the AlgorithmsPseudocode2 file in the Lesson Resources folder. Emphasize:
1. Whenever you need to store information, it must go into a variable. So think about what variables might be needed when you are creating your algorithm
2. Program steps are executed in the order they are listed from top to bottom.
3. Selection and Iteration statements require conditionals. Identify a conditional as something that returns a True or False answer. If selects the next statement to occur by answering the conditional question as being true or false. I have in the past pointed out the True and Then both start with T so TRUE always does the THEN, wherease Else and False both end with LSE, so when the answer if FALSE, you do the ELSE.
While continues to loop as long as the conditional answer is TRUE. When the conditional answer is false, the algorithm jumps to the statement after the End While.
4. Nearly all programming languages are equivalent in terms of being able to express any algorithm. Each has its own way to use variables, conditions and repetition which are needed for a solution to almost all algorithms. Clarity and readability are important considerations when expressing an algorithm in a natural language or a programming language
During powerpoint, guide students through the Game of Matching Pennies (a student working copy and a solution key is in the Master Teacher Resource folder for this lesson).
Students work in pairs to create and share their pseudocode. Use the Rock Paper Scissors hand out to have student pairs psuedocode Rock Paper Scissors. Your algorithm should play the game 10 times and count the number of times each player wins and the number of times they tie.
Students may create their algorithms form scratch or remix exisiting ones.
If there is time, have groups switch algorithms and critique the algorithm of the other group.
Walk through pseudocode syntax summary handout called Pseudocode Summary and Examples of common Algorithms.docx in Lesson Resources folder.
Students work through challenges and check their results against sample solutions.
Review slide: "Why we have leap years."
Questions in the AP Classroom Question Bank may be used for summative purposes.
Sixty of the 80 questions are restricted to teacher access. The remaining 20 questions are from public resources.
Questions are identified by their initial phrases.
A flowchart is a way to visually represent an a...
A programmer completes the user manual for a vi...
An algorithm has been developed to compute the ...
Central High School keeps a database of informa...
Consider the code segment below. The code consi...
Consider the following code segment. A segment of
The algorithm below is used to simulate the res...
The question below uses a robot in a grid of sq...
Two lists, list1 and list2, contain the names o...
Assign students to create pseudocode for leap years.
Pairing of students and crossing pairs to form groups of four should be used for the set of exercises that are part of this lesson.
Students will write pseudocode for algebra / geometry formulas. These will be entered into their class notes.
Students will write pseudocode for determining if a year is a leap year. This will be entered into their journals.