AP CSP CodeX - From Flowcharts to Code

From Flowcharts to Code Lesson Plan

From Flowcharts to Code

Students match flowchart symbols to Python and write Python code from flowcharts.

⏰ 45 min 🎯 Grades 9-12 πŸ’» CodeSpace 🐍 Python
View Lesson Outline
πŸ“‹

Overview

Students review the four basic flowchart symbols, then turn flowcharts into Python code. There are six flowcharts in the activity, and you can choose a few that fit your students or give students choices. Each line or lines of Python code can be visualized as a flowchart symbol, and similar lines can be grouped into a single symbol. Students should be able to explain their code without using Python. The Flowcharts and Code Review checks for mastery.

🎯 Mission Goal: Students will create Python code from flowcharts.

🎯

Learning Targets

  • I can map a flowchart symbol to Python code.
  • I can write Python code from a flowchart.
πŸ’‘

Key Concepts

  • Each line or lines of Python code can be visualized as a flowchart symbol.
  • Sometimes it is convenient to group similar lines of Python code into a single flowchart symbol.
β˜‘οΈ

Success Criteria

  • Name the four basic flowchart symbols and what they are used for
  • Create Python code from a flowchart
🧰

Classroom Materials

  • β–ΈComputer
  • β–ΈFlowcharts to view on a large screen, printed for each group, or on student computers
  • β–ΈFlowcharts and Code Review (printed or digital)
🌍

Real-World Applications

Flowcharts turn complex, multi-step processes into clear visual maps that guide decisions.

🎧Customer support: Service ticketing trees map out how each agent greets users, diagnoses known bugs, or sends the ticket up the line to a senior specialist.
πŸ₯Health care and medicine: Clinical treatment protocols help emergency staff follow precise diagnostic rules and medication rules based on patient vital signs.
πŸ‘₯Human resources: Onboarding procedures direct the new hire paperwork, IT equipment requests, and managerial sign-offs.
πŸš€

Extensions & Cross-Curricular

ExtensionStudents draw a flowchart for an everyday task, such as making breakfast, using the four basic symbols, then write the Python code for it.
ExtensionStudents trade finished programs with a partner and draw the flowchart that matches their partner's code.
MathStudents draw a flowchart that decides if a number is even or odd, then write the Python code for the decision.
Lang ArtsStudents explain one of their programs in plain English, without using Python, so a classmate could follow the steps.
ScienceStudents draw a flowchart for a science process, such as the steps of a lab procedure or deciding if a sample is an acid or a base.
πŸ”€

Vocabulary

β–Ύ
Flowchart - A visualization, or graphic organizer, of an algorithm. A diagram that uses shapes, lines, and arrows to sequence steps; a visual representation of the input, output, decisions, and actions that take place within a program.
Algorithm - A sequence of steps for completing a task (step by step process).
πŸ“

Standards

β–Ύ

CSTA Standards - Grades 9-10

3A-AP-13

CSTA Standards - Grades 11-12

3B-AP-10

AP CSP Framework

AAP-2.A - Express an algorithm that uses sequencing without using a programming language.
AAP-2.G - Express an algorithm that uses selection without using a programming language.
Computational Thinking Practice 2.A - Represent algorithmic processes without using a programming language.
πŸ“
Preparing for the Lesson
  • Look over the six flowcharts. You may not want to use all of them. Select a few that are suitable for your students, or give them choices (like mild, medium and spicy) and ask them to complete three.
  • Decide how students will see the flowcharts: on a large screen, printed for each group, or on their own computers while they write Python code.
  • Prepare the Flowchart Shapes Kahoot! Review for the warm-up.
  • If you will print the Flowcharts and Code Review, give more room in the first part for drawing shapes.

πŸ§‘β€πŸ«
Teacher Notes
  • This lesson works well individually, with partners, or in groups of three.
  • All the solution codes in the answer key are just samples. The programs students create can be different, but should be similar.
  • This lesson may take longer than one class period. If so, you have a couple choices. You can cut the lesson short. Not every flowchart needs to be changed to code. Whatever code students get done is fine. Or you can extend the lesson an additional day and use the review. You can decide how much you want to emphasize flowcharts. Students should be able to explain their code without using Python. This is one way to give them practice, but it is not the only way.
  • The review is a good way to check for mastery. You can print the review for students and have them write their answers. If you print the document, give more room in the first part for drawing shapes. You can also assign a digital copy of the review. Students can insert the shapes, or describe the shape and text.
πŸ—ΊοΈ

Lesson Outline

This outline gives one way to present the lesson.

πŸ—£οΈWarm-up

Slides 2-6: Review the flowchart symbols. Use the Flowchart Shapes Kahoot! Review.

πŸ’»From Flowcharts to Code

Slides 7-8: Instructions.

Slides 9-14: Students use the flowcharts to create Python code.

Teaching tip: This lesson could run long. Not every flowchart needs to be changed to code. Whatever code students get done is fine, or choose just a few of the six flowcharts for the activity. Or you can extend the lesson an additional day and use the review. You can decide how much you want to emphasize flowcharts. Students should be able to explain their code without using Python. This is one way to give them practice, but it is not the only way.
πŸ§‘β€πŸ€β€πŸ§‘Wrap-Up

πŸ’» Slide 15: Summary.

Teaching tip: Flowcharts and Code Review: The review is a good way to check for mastery. You can print the review for students and have them write their answers. If you print the document, give more room in the first part for drawing shapes. You can also assign a digital copy of the review. Students can insert the shapes, or describe the shape and text.
Teaching tip: If you do not have time for the review at the end of the lesson, it can always be given a different day to keep the information fresh. A half day, or assembly day, is a good time for a quick review.

βœ… Formative assessment:

  • Daily reflection journal
  • Activity Guide completion
  • Class discussion on what they learned or difficulties they had
  • Exit ticket