Please enable JavaScript to use CodeHS


Intro to Computer Science in Python 3

Lessons

  1. Welcome

    1. 1.1 Welcome

    2. Description

      This lesson introduces students to an overview of the Intro to Python course while probing their thinking on what it means to be successful in an online (or blended learning) course.

    3. Objective

      Students will be able to:

      • describe the audience, relevance, and outcomes of the Intro to Python course
      • reflect on the practices and strategies that will help them be successful in an online (or blended) learning class
  2. Introduction to Programming with Turtle Graphics

    1. 2.1 Intro to Python with Tracy the Turtle

    2. Description

      In this lesson, students are introduced to coding with turtle graphics. Students will begin to recognize programs as sequences and groups of commands. Students will learn a few basic commands and then apply them right away by writing their first program.

    3. Objective

      Students will be able to:

      • Define programming/coding
      • Use basic Tracy commands
      • Write their first program
    4. 2.2 Tracy's Grid World

    5. Description

      In this lesson, students will be introduced to the layout of Tracy’s grid world and will learn how to use coordinate pairs to locate Tracy on the coordinate plane. They will add to the list of commands they know and can use to create Tracy graphics.

    6. Objective

      Students will be able to:

      • Locate Tracy on the coordinate plane
      • Use the penup(), pendown(), and backward() commands in their programs
    7. 2.3 Turning Tracy

    8. Description

      In this lesson, students will learn how to use the left and right commands in order to move Tracy to more locations on the canvas. They will now have many commands that can be used to have Tracy create more complex graphics.

    9. Objective

      Students will be able to:

      • Use the left and right commands in order to move Tracy around her grid world
    10. 2.4 For Loops

    11. Description

      In this lesson, students are introduced to for loops. They learn how for loops simplify the process of making small changes to a program and help avoid repeating code. For loops are written like this:

      for i in range (4):
          // Code to be repeated 4 times
    12. Objective

      Students will be able to:

      • Create for loops to repeat code a fixed number of times
      • Explain when a for loop would be a useful tool
      • Utilize for loops to write programs that would be difficult / impossible without loops
    13. 2.5 Turning Tracy Using Angles

    14. Description

      In this lesson, students are introduced to the ability to turn Tracy at any angle. With this feature, Tracy can now draw diagonal lines which opens up the possibility to draw multiple shapes that weren’t previously available.

    15. Objective

      Students will be able to:

      • Use angles inside turning commands
      • Turn Tracy at angles in conjunction with for loops
    16. 2.6 Comments

    17. Description

      In this lesson, students learn how to use comments to describe their programs. Comments are helpful because they allow programmers to leave notes about the programs they are writing. Students will also learn about the different types of comments that can be used and the benefits of using them.

    18. Objective

      Students will be able to:

      • Use comments throughout their program
      • Describe why comments are helpful for both themselves and anyone else looking at their code
    19. 2.7 Naming Guidelines

    20. Description

      In this short lesson, students will be introduced to the rules for naming elements in their code. Variables and functions that are used inside their programs will be named by students, so the following guidelines should be obeyed to be sure that the programs written are readable and successful.

    21. Objective

      Students will be able to:

      • Name elements of their code by following specific guidelines and rules in order to create readable and working programs
    22. 2.8 Functions

    23. Description

      In this lesson, students are introduced to functions. They start with the basics of defining a function and why we need them and will revisit a program they coded earlier in the unit to rewrite it using functions.

    24. Objective

      Students will be able to:

      • Define a function
      • Call a function
      • Explain why functions are used
    25. 2.9 Artistic Effects

    26. Description

      In this lesson, students are able to add some flair to their turtle graphics programs by controlling color, pensize, and fill. These new commands are added to the list of commands that have been already practiced in order to allow for more creativity in student programs.

    27. Objective

      Students will be able to:

      • Use the extended circle() command to draw different shapes
      • Use the color(), pensize(), begin_fill(), and end_fill() commands to add more creativity to their programs
    28. 2.10 Top Down Design

    29. Description

      In this lesson, students are introduced to the concept of Top Down Design. Top Down Design is the process of breaking down a program into functions or smaller parts to avoid repeated code and to make our programs more readable.

    30. Objective

      Students will be able to:

      • Break a large problem down into smaller pieces
      • Write functions to solve each smaller problem
      • Solve a complicated problem using Top Down Design
    31. 2.11 Variables

    32. Description

      In this lesson, students will learn about a fundamental aspect of every programming language: Variables. A variable is something that stores information in a program that can be used later.

    33. Objective

      Students will be able to:

      • Describe what variables are
      • Discuss why variables are used in our programs
    34. 2.12 User Input

    35. Description

      In this lesson, students will learn how to incorporate user input into their programs. Students will learn how to request user input as both strings and integers, where the input is stored, and how to convert strings and integers.

    36. Objective

      Students will be able to:

      • Incorporate user input into their code in order to customize their programs
    37. 2.13 Parameters

    38. Description

      In this lesson, students will dive deeper into the concept of functions by exploring how to use parameters to customize their code.

    39. Objective

      Students will be able to:

      • Incorporate parameters into their functions in order to adapt their functions to multiple situations
    40. 2.14 Using i in For Loops

    41. Description

      In this lesson, students will expand their knowledge of for loops. They are aware that for loops execute the same lines of code a given number of times but will learn that i is actually a variable that can be used to control commands inside the loop as it is running.

    42. Objective

      Students will be able to:

      • Use i as a variable inside their for loop to control different commands
    43. 2.15 Extended Loop Control

    44. Description

      In this lesson, students will learn the extended parameters that can be used to control the value of i in for loops. They will then be able to use the variable i to control much more of their code by setting specific values.

    45. Objective

      Students will be able to:

      • Control the value of i using extended parameters
    46. 2.16 If Statements

    47. Description

      In this lesson, students will learn how to use If Statements which will allow them to use conditions to determine how their code should run.

    48. Objective

      Students will be able to:

      • Use if statements in order to tell Tracy how to make decisions
    49. 2.17 If/ Else Statements

    50. Description

      In this lesson, students will learn how to expand on If Statements by including a way to have Tracy make decisions between multiple scenarios.

    51. Objective

      Students will be able to:

      • Use if/else statements in order to have Tracy make decisions between multiple scenarios
    52. 2.18 While Loops

    53. Description

      In this lesson, students will learn that while loops allow code to be executed repeatedly based on a condition. They will also be warned that infinite loops are created if the exit condition of the while loop is never met, causing the code inside the while loop to repeat continuously which causes the program to crash.

    54. Objective

      Students will be able to:

      • Effectively use while loops in their programs
      • Identify infinite loops
    55. 2.19 Putting Together Control Structures

    56. Description

      In this lesson, students will put together all the concepts they’ve learned thus far. They will be able to use top down design and to write programs that will solve complex problems.

    57. Objective

      Students will be able to:

      • Identify the different control structures we can use to modify the flow of control through a program
      • Combine control structures to solve complicated problems
      • Choose the proper control structure for a given problem
    58. 2.20 Intro to Programming with Turtle Graphics Quiz

    59. Description

      In this lesson, students review content with a 25 question End-of-Unit Quiz.

    60. Objective

      Students will be able to:

      • Prove their knowledge of control structures and coding concepts through a multiple choice quiz
  3. Basic Python and Console Interaction

    1. 3.1 Printing in Python

    2. Description

      In this lesson, students will learn how to make the most basic python program- one that displays text on the screen. Students will learn how to print in python using the print statement. They will also learn how to use quotations, apostrophes, and strings.

    3. Objective

      Students will be able to:

      • Print text in Python
    4. 3.2 Variables and Types

    5. Description

      In this lesson, students will be reintroduced to the concept of variables, which store information in a program to be used later. Students will also learn about three different variable types- strings, integers, and floating point numbers.

    6. Objective

      Students will be able to:

      • Define Python variables and types
    7. 3.3 User Input

    8. Description

      In this lesson, students revisit user input. They learn how to request user input as both strings and integers, learn where the input is stored, and learn how to convert strings and integers.

    9. Objective

      Students will be able to:

      • Incorporate user input into their programs
      • Convert between variable types
    10. 3.4 Mathematical Operators

    11. Description

      In this lesson, students will learn about using mathematical operators in their Python programs. They will work through multiple examples to get comfortable with operator precedence and using different types of operators.

    12. Objective

      Students will be able to:

      • Describe the different mathematical operators that can be used in their programs
      • Create programs that use basic math to compute useful things
      • Create programs that take in user input, do simple computations with the input, and produce useful output
    13. 3.5 String Operators

    14. Description

      In this lesson, students will be able to perform string operations in order to concatenate values together.

    15. Objective

      Students will be able to:

      • Use mathematical operators with strings
    16. 3.6 Comments

    17. Description

      In this lesson, students revisit the concept of comments. Comments are helpful because they allow programmers to leave notes about the program they are writing.

    18. Objective

      Students will be able to:

      • Incorporate comments into their programs in order to make them more readable
    19. 3.7 Basic Python and Console Interaction Quiz

    20. Description

      In this lesson, students review content with a 20 question Unit Quiz.

    21. Objective

      Students will be able to:

      • Prove their knowledge of basic coding concepts through a multiple choice quiz
  4. Conditionals

    1. 4.1 Booleans

    2. Description

      In this lesson, students will revisit the concept of boolean values. Booleans refer to a value that is either true or false. Named after English-born mathematician, philosopher and logician, George Boole, Booleans are used to test whether a condition is true or false.

    3. Objective

      Students will be able to:

      • Create boolean variables to represent meaningful yes/no values
      • Print out the value of a boolean variable
    4. 4.2 If Statements

    5. Description

      In this lesson, students will review how to use If and if/else statements. These statements allow programmers to use conditions to determine how their code should run.

    6. Objective

      Students will be able to:

      • Use if statements for control flow in their programs
    7. 4.3 Comparison Operators

    8. Description

      In this lesson, students will dive into comparison operators. Comparison operators give the ability to compare two values. Using comparison operators in programming is similar to math in that less than <, greater than >, less than or equal to <=, and greater than or equal to >= are the same. The differences are that operators for equal to are == and not equal are !=. Using comparison operators allow programs to make decisions.

    9. Objective

      Students will be able to:

      • Explain the meaning of each of the comparison operators (<, <=, >, >=, ==, !=)
      • Create programs using the comparison operators to compare values
      • Predict the boolean result of comparing two values
      • Print out the boolean result of comparing values
    10. 4.4 Logical Operators

    11. Description

      In this lesson, students will look at logical operators. Logical operators give the ability to connect or modify Boolean expressions. Three logical operators are NOT (!), or and and. These logical operators can be used in combination. With these logical operators, logical statements can be constructed, such as “I go to sleep when I am tired OR it’s after 9pm”, “I wear flip flops when I am outside AND it is NOT raining”.

    12. Objective

      Students will be able to:

      • Describe the meaning and usage of each logical operator: or, and, and NOT (!)
      • Construct logical statements using boolean variables and logical operators
    13. 4.5 Floating Point Numbers and Rounding

    14. Description

      In this lesson, students learn about the intricacies of floating point numbers. When using comparison operators with floating point numbers in Python, we will sometimes see strange behavior because of bizarre rounding methods. When using a comparison operator with floating point numbers, you should use round(x) to avoid strange rounding behavior. round(x, n) will round the float x to n decimal places. round(x) will round the float x to 0 decimal places.

    15. Objective

      Students will be able to:

      • Use floating point numbers
      • Round values in their programs
    16. 4.6 Conditionals Quiz

    17. Description

      In this lesson, students review content with a 15 question Unit Quiz.

    18. Objective

      Students will be able to:

      • Prove their knowledge of conditionals through a multiple choice quiz
  5. Looping

    1. 5.1 While Loops

    2. Description

      In this lesson, students learn to use while loops in their Python programs. While loops allow code to be executed repeatedly based on a condition. They are also reminded of the possibility of creating an infinite loop, which occurs if the exit condition of the while loop is never met, causing the code inside the while loop to repeat continuously.

    3. Objective

      Students will be able to:

      • Effectively use while loops in their programs
      • Detect and resolve infinite loops
    4. 5.2 For Loops

    5. Description

      In this lesson, students will explore how to use for loops in their Python programs. They will be reminded how to use i as a variable in their programs as well as how to control the values of i by altering the starting, ending, and interval values.

    6. Objective

      Students will be able to:

      • Implement for loops
      • Use the variable i as a counter
      • Control the values of i in a for loop
    7. 5.3 Break and Continue

    8. Description

      In this lesson, students learn about break and continue statements. A break statement is used to immediately terminates a loop. A continue statement is used to skip out of future commands inside a loop and return back to the top of the loop. These statements can be used with for or while loops.

    9. Objective

      Students will be able to:

      • Explain the critical difference between break and continue
      • Describe why a break or continue statement would be needed in a coding scenario
    10. 5.4 Nested Control Structures

    11. Description

      In this lesson, students will use control structures within control structures, which are referred to as nested control structures.

    12. Objective

      Students will be able to:

      • Identify the different control structures that can be used to modify the flow of control through a program
      • Combine control structures to solve complicated problems
      • Choose the proper control structure for a given problem
    13. 5.5 Looping Quiz

    14. Description

      In this lesson, students review content with a 15 question Unit Quiz.

    15. Objective

      Students will be able to:

      • Prove their knowledge of loops through a multiple choice quiz
  6. Functions and Exceptions

    1. 6.1 Functions

    2. Description

      In this lesson, we learn about Functions. Functions let us break our program into different parts that we can organize and reuse however we like. Functions are the main building block of complex Python programs.

    3. Objective

      Students will be able to:

      • modularize their programs with functions
    4. 6.2 Functions and Parameters

    5. Description

      In this lesson, we dive deeper into the concept of functions by exploring how to use parameters.

    6. Objective

      Students will be able to:

      • Effectively use parameters to customize functions in their programs
    7. 6.3 Namespaces in Functions

    8. Description

      In this lesson, we explore where variables exist and what the difference is between a local and global variable.

    9. Objective

      Students will be able to:

      • describe the different namespaces with regards to variables and functions
    10. 6.4 Functions and Return Values

    11. Description

      In this lesson, students explore functions with return values and deepen their understanding of and ability to use functions.

    12. Objective

      Students will be able to:

      • remove complexity from their programs by abstracting with functions
      • generalize their functions with parameters
      • chain functions together using return values
    13. 6.5 Exceptions

    14. Description

      In this lesson, students explore Python’s way of handling errors with exceptions.

    15. Objective

      Students will be able to:

      • create programs that can gracefully handle exceptions
      • continue to function when an error is raised
    16. 6.6 Functions Quiz

    17. Description

      In this lesson, students review content with a 15 question Unit Quiz.

    18. Objective

      Students will be able to:

      • Prove their knowledge of functions and exceptions through a multiple choice quiz
  7. Strings

    1. 7.1 Indexing

    2. Description

      Students will learn how indexing can be used to specify a specific character in a string based on location.

    3. Objective

      Students will be able to:

      • use indexing in order to find a specific character in a string
    4. 7.2 Slicing

    5. Description

      Students will learn how slicing allows them to select multiple string values at once from a given string.

    6. Objective

      Students will be able to:

      • use slicing to select a set of values from a string
    7. 7.3 Immutability

    8. Description

      In Python, strings have the property of “immutability” which means they cannot be mutated or changed. You can assign strings to variables, and reassign new strings to the same variable, but individual characters within a string cannot be reassigned.

    9. Objective

      Students will be able to:

      • explain what immutability is and how this applies to strings in Python
    10. 7.4 Strings and For Loops

    11. Description

      In this lesson, students will look at the use of for loops with strings. Since both string indices and for loops index at zero, the len value can be used to go through strings in a for loop. Indicies don’t need to be explicitly used. The syntax for character in my_string can be used to go through a for loop one character at a time.

    12. Objective

      Students will be able to:

      • iterate over characters in a string using for loops
    13. 7.5 The in Keyword

    14. Description

      In this lesson, students will see how the in keyword can be used in an if statement to see if a particular letter or substring is in a string.

    15. Objective

      Students will be able to:

      • use the in keyword to check if a character is in a string
    16. 7.6 String Methods

    17. Description

      In this lesson, students will learn about string methods. Methods are basically functions that you call on objects and can be used to alter our strings in different ways.

    18. Objective

      Students will be able to:

      • use various string methods to alter string values
    19. 7.7 Strings Quiz

    20. Description

      In this lesson, students review content with a 20 question Unit Quiz.

    21. Objective

      Students will be able to:

      • Prove their knowledge of strings through a multiple choice quiz
  8. Creating and Altering Data Structures

    1. 8.1 Tuples

    2. Description

      In this lesson, students will learn about and practice using tuples. A tuple is a heterogenous, immutable data type that stores an ordered sequence of things that can be accessed using indices.

    3. Objective

      Students will be able to:

      • create and store information in tuples
      • explain the characteristics of a tuple
    4. 8.2 Lists

    5. Description

      In this lesson, students will learn about their second data structure, lists. A list is a mutable, heterogeneous data type that stores an ordered sequence of things.

    6. Objective

      Students will be able to:

      • understand and explain the characteristics of a list
      • use lists to store and recall information
    7. 8.3 For Loops and Lists

    8. Description

      In this lesson, students will learn how lists can be iterated over in a similar way to strings.

    9. Objective

      Students will be able to:

      • understand and explain the characteristics of a list
      • use for loops to go through items in a list
    10. 8.4 List Methods

    11. Description

      Methods, in general, are like functions that can be called on objects. Students have seen previously how string methods are called on strings. In this lesson, students will learn about the various list methods that can be called on lists!

    12. Objective

      Students will be able to:

      • apply useful list methods to alter and access information about a list
    13. 8.5 Creating and Altering Data Structures Quiz

    14. Description

      In this lesson, students review content with a 15 question Unit Quiz.

    15. Objective

      Students will be able to:

      • Prove their knowledge of basic data structures through a multiple choice quiz
  9. Extending Data Structures

    1. 9.1 2d Lists

    2. Description

      In this lesson, students will learn how 2d lists are stored and how to use indexing and slicing to extract specific items from a list of lists.

    3. Objective

      Students will be able to:

      • Use 2d lists to store information in rows and columns
    4. 9.2 List Comprehensions

    5. Description

      In this lesson, students will learn how to use list comprehensions to alter the items in a list with one line of code.

    6. Objective

      Students will be able to:

      • Perform list comprehensions in order to alter all items in a list at once
    7. 9.3 Packing and Unpacking

    8. Description

      In this lesson, students will learn how packing and unpacking makes assigning variables to list items very easy and quick.

    9. Objective

      Students will be able to:

      • Pack and unpack lists in order to quickly and efficiently assign variables to list items
    10. 9.4 Dictionaries

    11. Description

      In this lesson, students will see how dictionaries differ from other data structures and why they are useful.

    12. Objective

      Students will be able to:

      • Use dictionaries to structure data
    13. 9.5 Equivalence vs. Identity

    14. Description

      In this lesson, students will learn the difference between equivalence and identity of values.

    15. Objective

      Students will be able to:

      • Predict if two values are identical and/or equivalent
    16. 9.6 Extending Data Structures Quiz

    17. Description

      In this lesson, students review content with a 15 question Unit Quiz.

    18. Objective

      Students will be able to:

      • Prove their knowledge of data structures through a multiple choice quiz
  10. Project: Guess the Word

    1. 10.1 Project: Guess the Word

    2. Description

      This project is broken up into several pieces to guide students through the game development.

    3. Objective

      Students will be able to:

      • use all concepts learned in this course to create a word guessing game in Python.
    4. 10.2 Intro to Computer Science in Python Completed

    5. Description

      Student has completed the entirety of the Intro to Computer Science in Python course!
      Encourage to continue learning about Python with the supplemental lessons and projects.

    6. Objective

      N/A

  11. Final Exam

    1. 11.1 Final Exam

    2. Description

      In this lesson, students review content with a final exam.

    3. Objective

      Students will be able to:

      • Prove their knowledge of coding in Python through a final exam
  12. Classes and Objects

    1. 12.1 Classes and Objects

    2. Description

      In this lesson, we will define what classes and objects are and learn how to break code down in this structure. They will learn how to use the init method to give attributes to objects.

    3. Objective

      SWBAT define class and object as well as create them inside their programs.

      SWBAT create an init method to give attributes to objects.

    4. 12.2 Methods

    5. Description

      In this lesson, we will begin defining and calling methods on objects.

    6. Objective

      SWBAT create methods inside class definitions and call them on objects.

    7. 12.3 Built-In Methods

    8. Description

      In this lesson, we will learn how to override the built-in methods repr and eq in order to define how the object will create a string representation of itself and define equivalence for a specific class.

    9. Objective

      SWBAT override the repr method to define how the object will create a string representation of itself.
      SWBAT override the eq method to define equivalence for this specific class.

    10. 12.4 Operator Overloading

    11. Description

      In this lesson, students will learn about operator overloading and how mathematical methods can be redefined by overriding their method in the class definition.

    12. Objective

      SWBAT override mathematical operators to redefine the way mathematical functions are performed.

    13. 12.5 Class Variables vs. Instance Variables

    14. Description

      In this lesson, students will learn about the difference between class and instance variables and how they are located.

    15. Objective

      SWBAT describe the differences between class and instance variables.

    16. 12.6 Inheritance

    17. Description

      In this lesson, students will learn how to use inheritance to make classes that are given attributes by other classes.

    18. Objective

      SWBAT use inheritance to create new classes that are given attributes by another class.

    19. 12.7 Hidden Attributes

    20. Description

      In this lesson, students will explore hidden attributes and why they are used. They will learn how to create getter and setter methods to retrieve and assign values of hidden attributes.

    21. Objective

      SWBAT assign hidden attributes in a program.
      SWBAT retrieve and assign hidden values by writing and using getter and setter methods.

    22. 12.8 Namespaces

    23. Description

      In this lesson, we explore how attributes are linked between objects and classes and the path they follow based on namespaces.

    24. Objective

      SWBAT describe the different namespaces with regards to classes and objects.

    25. 12.9 Modules

    26. Description

      In this lesson, we explore different ways to import modules to be used in our programs.

    27. Objective

      SWBAT import and use modules in their programs.

    28. 12.10 Classes and Objects Quiz

    29. Description

      Students review content with a 20 question Unit Quiz.

    30. Objective

      SWBAT complete Unit Quiz.

  13. Advanced Tracy Challenges

    1. 13.1 Advanced Challenges with Tracy

    2. Description
    3. Objective
  14. Midterm

    1. 14.1 Midterm

    2. Description

      In this lesson, students review content with a midterm.

    3. Objective

      Students will be able to:

      • Prove their knowledge of coding in Python through a midterm
  15. Additional Topics

    1. 15.1 Short Circuit Evaluation

    2. Description
      • If Python can determine what an expression evaluates to without reading the entire expression, it will not read the entire expression.
      • Because True or anything evaluates to True regardless of the second value, Python will read the statement as true without evaluating the second expression.
      • Because False and anything evaluates to False regardless of the second value, Python will read the statement as false without evaluating the second expression.
    3. Objective

      Students learn how to short circuit their program.

    4. 15.2 De Morgan's Laws

    5. Description
      • The expression not (A or B) is equivalent to the expression not A and not B
      • The expression not (A and B) is equivalent to the expression not A or not B
    6. Objective

      Students will be able to explain how we can negate expressions with and and or.

    7. 15.3 Abstraction

    8. Description

      In this lesson, students will learn about abstraction. Abstraction is the act of managing complexity by dissociating information and details in order to focus on relevant concepts.

    9. Objective

      Students will be able to:

      • Understand abstraction as the different levels of detail and complexity
      • Understand the importance of abstracting away complexity to solve problems more efficiently
    10. 15.4 Adding Text

    11. Description

      In this lesson, students will learn how to use the write function to add text labels to their programs.

    12. Objective

      Students will be able to:

      • Use the write command to add text to their programs
      • Concatenate strings and integers using the str keyword
  16. Project: Who Said It?

    1. 16.1 Project: Who Said It?

    2. Description
    3. Objective
  17. Python Graphics (Tkinter)

    1. 17.1 Creating the Canvas

    2. Description

      In this lesson, students will begin working with Tkinter to develop graphics programs in Python. They will learn how to create, size, and color a canvas and add lines using the Tkinter coordinate system.

    3. Objective

      Students will be able to:

      • Explain when Tkinter is and what it is used for
      • Create canvases of a specific size and draw lines using the Tkinter coordinate system
    4. 17.2 Shapes and Attributes

    5. Description
    6. Objective
    7. 17.3 Creating Graphics Using Variables

    8. Description
    9. Objective
    10. 17.4 Using Functions in Graphics

    11. Description
    12. Objective
    13. 17.5 Using Loops in Graphics

    14. Description
    15. Objective
    16. 17.6 Graphics Challenges

    17. Description
    18. Objective
  18. Project: Mastermind

    1. 18.1 Let's Build Mastermind

    2. Description
    3. Objective
  19. Categorizing Triangles

    1. 19.1 Calculating Area

    2. Description

      Students will learn about functions and parameters, and take an in-depth look at a function that prints text to the screen. They will write an equation to calculate area of a triangle and use a function to print the area value to the screen.

    3. Objective

      SWBAT use functions, parameters, and variables to calculate area of a triangle and print the area to the screen.

    4. 19.2 Categorizing Triangles with a Static Base Value

    5. Description

      Students will learn about if/else statements and conditions in order to categorize triangles into one of 4 categories- Acute, Obtuse, Right, and Equilateral. They will also learn how to write and use comparison and logical operators in Python programs.

    6. Objective

      SWBAT use comparison and logical operators to write if/else statements that correctly categorize triangles.

    7. 19.3 Categorizing Triangles with a Varied Base Value

    8. Description

      Students will learn more about variables and will use algebra to rearrange equations to solve for unknown values. They will also learn to use the ‘round’ and ‘sqrt’ functions.

    9. Objective

      SWBAT write a more reusable program that will check for triangle type with any given base value.

  20. Extra Resources

    1. 20.1 Extra Resources

    2. Description
    3. Objective
  21. Using and Storing Data

    1. 21.1 Using Requests

    2. Description
    3. Objective
  22. Python Graphics (Brython)

    1. 22.1 Creating Text & Lines

    2. Description

      In this lesson, students will begin working with Brython to develop graphics programs in Python. They will learn how to create, size, and color a canvas and add lines using the Brython coordinate system.

    3. Objective

      Students will be able to:

      • Explain when Brython is and what it is used for
      • Create canvases of a specific size and draw lines using the Brython coordinate system
    4. 22.2 Creating Shapes

    5. Description
    6. Objective
    7. 22.3 Creating Graphics Using Variables

    8. Description
    9. Objective
    10. 22.4 Using Functions in Graphics

    11. Description
    12. Objective
    13. 22.5 Using Loops in Graphics

    14. Description
    15. Objective
    16. 22.6 Graphics Challenges

    17. Description
    18. Objective
  23. Karel in Python

    1. 23.1 Welcome to AP CSP

    2. Description

      In this lesson, students will discuss how computing is used. They will also set goals for this course and beyond.

    3. Objective

      Students will be able to:

      • Identify and brainstorm ways computers have impacted their own lives, as well as society, economy, and culture
      • Develop their own learning objectives for the course by reflecting on why they are taking this course
    4. 23.2 Introduction to Programming With Karel

    5. Description

      In this lesson, students are introduced to Karel the Dog and how Karel can be given a set of instructions to perform a simple task.

    6. Objective

      Students will be able to:

      • Recognize, explain, and use the commands that Karel can be given. These commands are: move(), put_ball(), take_ball() and turn_left().
    7. 23.3 More Basic Karel

    8. Description

      In this lesson, students build on their understanding of how Karel the Dog can be given a set of instructions to perform a simple task.

    9. Objective

      Students will be able to:

      • Recognize, explain, and use the commands that Karel can be given
      • Debug and rework their code as well as someone else’s code
    10. 23.4 Karel Can't Turn Right

    11. Description

      In this lesson, students will learn how to define and call a function using proper syntax.

    12. Objective

      Students will be able to:

      • Define and call functions
    13. 23.5 Functions in Karel

    14. Description

      In this lesson, functions will be used to teach Karel a new word or command. Using functions allows programs to be broken down into smaller pieces and makes it easier to understand.

    15. Objective

      Students will be able to:

      • Understand what functions are, how they are used and how using them improves programs
      • Design and implement their own functions to solve problems
    16. 23.6 Top Down Design and Decomposition in Karel

    17. Description

      In this lesson, students learn top down design and decomposition as the processes of breaking big problems into smaller, manageable pieces. The functions improve the readability of the code and avoid repeated code.

    18. Objective

      Students will be able to:

      • Break a large problem down into smaller, simpler problems
      • Write functions that solve the simpler problems, and use them as building blocks to solve the larger problem
      • Compare programs and identify good vs. poor decomposition
    19. 23.7 Commenting Your Code

    20. Description

      In this lesson, students will learn how to utilize comments in their code to explain what their code is doing. Comments should include preconditions and postconditions. Preconditions are assumptions we make about what is true before a function is called in our program. Postconditions are what should be true after a function is called in our program.

    21. Objective

      Students will be able to:

      • Explain the preconditions and postconditions of a function
      • Create clear and readable comments in their code that help the reader understand the code
      • Explain the purpose of comments
    22. 23.8 Abstraction

    23. Description

      In this lesson, students will learn about abstraction. Abstraction is the act of managing complexity by dissociating information and details in order to focus on relevant concepts.

    24. Objective

      Students will be able to:

      • Understand abstraction as the different levels of detail and complexity
      • Understand the importance of abstracting away complexity to solve problems more efficiently
    25. 23.9 Super Karel

    26. Description

      In this lesson, students will be introduced to SuperKarel and APIs. SuperKarel includes commands like turn_right() and turn_around() since they are so commonly used. These commands come prepackaged with the SuperKarel library (API).

    27. Objective

      Students will be able to:

      • Write programs that use SuperKarel instead of Karel
      • Utilize the new toolbox of commands that SuperKarel provides over Karel
      • Read the documentation to understand how to use an API (SuperKarel is an example of this)
    28. 23.10 For Loops

    29. Description

      In this lesson, students learn how to use for loops in their programs. The for loop allows you to repeat a specific part of code a fixed number of times.

      A for loops is written as follows:

      for i in range(4):
          # Code to be repeated 4 times
      
      
    30. Objective

      Students will be able to:

      • Create for loops to repeat code a fixed number of times
      • Explain when a for loop would be a useful tool
      • Utilize for loops to write programs that would be difficult/impossible without loops
    31. 23.11 If Statements

    32. Description

      In this lesson, students will learn about conditions and if statements. A condition is a function that returns a true/false answer. Python uses if statements as a way to make decisions and execute specific code. If statements are helpful in writing code that can be used in different situations.

    33. Objective

      Students will be able to:

      • Use conditions to gather information about Karel’s world (is the front clear, is Karel facing north, etc)
      • Create if statements to only execute code if a certain condition is true
    34. 23.12 If/Else Statements

    35. Description

      In this lesson, students will take a deeper look into conditional statements, more specifically if/else statements. If/else statements allow for one thing to be done if a condition is true, and something else otherwise.

      We write if/else statements like this:

      if front_is_clear():
          # code to execute if front is clear
      elif balls_present():
          # code to execute otherwise
    36. Objective

      Students will be able to:

      • Explain the purpose of an If/Else statement
      • Create If/Else statements to solve new types of problems
      • Identify when an If/Else statement is appropriate to be used
    37. 23.13 While Loops in Karel

    38. Description

      In this lesson, students are introduced to a new type of loop: while loops. While loops allow Karel to repeat code while a certain condition is true. While loops allow for the creation of general solutions to problems that will work on multiple Karel worlds, rather than just one.

    39. Objective

      Students will be able to:

      • Explain the purpose of a while loop
      • Create while loops to repeat code while a condition is true
      • Utilize while loops to solve new types of problems
      • Test their solutions on different Karel worlds
    40. 23.14 Control Structures Example

    41. Description

      In this lesson, students take a look at all of the control structures. Control structures can be selective, like if and if / else statements and are based on a condition. Other control structures are iterative and allow for repeated code like for loops and while loops. Basically, control structures control the way the commands execute.

    42. Objective

      Students will be able to:

      • Identify the different control structures that can be used to modify the flow of control through a program
      • Combine control structures to solve complicated problems
      • Choose the proper control structure for a given problem
    43. 23.15 Debugging Strategies

    44. Description

      Debugging is a very important part of programming. In this lesson, students learn how to effectively debug their programs.

    45. Objective

      Students will be able to use debugging strategies to find and fix errors in their code.

    46. 23.16 Algorithms

    47. Description

      In this lesson, students are introduced to algorithms which are step by step instructions that solve a problem. Programs implement algorithms. All algorithms are built using sequencing, selection, and iteration. Karel has control structures for each of these. This lesson is designed to test students’ knowledge of control structures and algorithm design in preparation for upcoming Karel challenges.

    48. Objective

      Students will be able to:

      • Analyze an algorithm and explain why it works
      • Use control structures to create general algorithms that work on all Karel worlds
    49. 23.17 Ultra Karel

    50. Description

      In this lesson, students are introduced to Ultra Karel! Ultra Karel has all the abilities of Super Karel, plus two new functions (paint and color_is) added to the API.

      Students will explore the Ultra Karel API and use Ultra Karel’s ability to paint the grid world to create digital images. Students will create generalized algorithms that solve Ultra Karel problems for multiple worlds.

      This lesson is the first time students will use functions that accept parameters as inputs.

    51. Objective

      Students will be able to:

      • Use Ultra Karel commands to paint Karel’s world
      • Call functions that accept parameters as inputs
      • Explain the relationship between a function and a parameter
      • Create generalized Ultra Karel algorithms that correctly solve multiple Karel worlds
      • Identify differences between the Super Karel API and the Ultra Karel API
    52. 23.18 Karel Challenges

    53. Description

      In this lesson, students will synthesize all of the skills and concepts learned in the Karel unit to solve increasingly challenging Karel puzzles.

    54. Objective

      Students will be able to:

      • Define a problem in their own words and plan out a solution to the problem
      • Break a large problem down into smaller pieces and solve each of the pieces, then use these solutions as building blocks to solve the larger problem
      • Utilize the proper control structures to create general solutions that solve multiple Karel worlds
      • Write clear and readable code using control structures, functions, decomposition, and comments
    55. 23.19 Introduction to Programming Quiz

    56. Description

      In this lesson, students complete a summative assessment of the unit’s learning objectives.

    57. Objective

      Students will be able to:

      • Prove their knowledge of control structures, functions, decomposition, and comments through a multiple choice quiz
  24. Python Level 1 Certification Practice

    1. 24.1 Practice #1: Basic Python and Console Interactions

    2. Description
    3. Objective
    4. 24.2 Practice #2: Conditionals

    5. Description
    6. Objective
    7. 24.3 Practice #3: Looping

    8. Description
    9. Objective
    10. 24.4 Practice #4: Strings

    11. Description
    12. Objective
    13. 24.5 Practice #5: Functions and Exceptions

    14. Description
    15. Objective
    16. 24.6 Practice #6: Data Structures

    17. Description
    18. Objective