DLT:
  • Write and apply knowledge of expressions
  • Distinguish between arithmetic, logical, and string expressions
  • Predict how an expression will evaluate based on knowledge of strings, numbers, and operator precedence
  • Use numbers in expressions
  • Parse data to change its type between strings, floats, and integers
  • Use operator precedence to evaluate an expression
  • Use and declare lists and dictionaries
  • Identify the appropriate data type (variable, list, or dictionary) to store information
  • Use a timer to end a game
  • Use code blocks to add visual and sound effects
  • Create an arcade-style game named "Asteroid Pong"

Vocabulary
  • Expression: An expression is any valid combination of variables, literals, and operators that compute to a single value.
  • Number: In Python, you can represent and store different types of numbers such as integers and decimals. However, Python does not have different data types for different types of numbers, as other languages do. Instead, it considers all of these types to be numbers.
  • Integer: An integer is a number that can be written without any fractions or decimals. For example, 0, 8, and -842 are integers, but 1.25, -6 ½, and √5 are not.
  • Float: A floating point number is a representation of a number that has a decimal point. There is no fixed number of digits before or after the decimal point - this is why the decimal point is said to "float." For example, 2.5, -15.089, and 1.0 are all interpreted as floats.
  • Hexadecimal Numbers: Numbers can be written in hexadecimal (base 16) format. This is most common for representing colors. You can recognize a hexadecimal number because it will begin with 0x and can include letters up to f as well as numbers.
  • Octal Numbers: Numbers can be written in octal (base 8) format. You can recognize an octal number because it starts with a leading zero.
  • Operator Precedence: Operator precedence is the order in which the operators in an expression are evaluated to get the expression’s value. The way that Python evaluates expressions is actually very similar to the way you learn to evaluate arithmetic operator precedence (PEMDAS) in school. If your code is ever not producing the result you expect, make sure that you’re following operator precedence. You can add parentheses if you’re ever not sure.
  • List: The list data type (known in other languages as an array) allows a variable to store multiple values in a single variable. In Python, a list is enclosed with square brackets. You must use array indexing to access elements of the list, starting from element zero in the first position. Here is an example:

    colors = ["red", "blue", "green"]

  • Dictionary: The dictionary data type uses named indexes to access elements. It maps names to values and each set of a name and value is known as a key-value pair. For example,

    leader = {

    'first_name': 'John',

    'last_name': "Doe"

    }

    Where key is 'first_name' and value is 'John'

Activities:
  • Tynker: Python Expressions - This lesson on may be a significant step up in complexity for many students, especially those who have not already worked with lists and dictionaries using block coding. Understanding operator precedence is an especially important skill because it helps students understand how a computer works on a deeper level and how it will evaluate an expression. Due at the end of class today.
  • Tynker: Asteroid Pong - Bring on the special effects! In this lesson, students will learn how to use a timer to end a game and switch from one animation to another. Due at the end of class today.