DLT:
  • Define and use strings, integers, floats, and booleans
  • Identify the difference between the four data types
  • Apply coding concepts to convert strings to integers
  • Apply coding concepts to convert integers to strings

Activity:
  • Tynker Python 201: Data Types - In this lesson, students are introduced to Python data types such as strings, numbers, and booleans.

  • Data Type: A data type is a particular kind of data. The type of the data determines what operations or functions can be performed on that data. Different data types cannot be combined with each other without converting the data type. Strings, integers, floats, and booleans are examples of data types in Python.
  • String: A string is a sequence of characters (letters) enclosed in either double or single quotes. Strings can be stored as variables and perform different functions on the strings. Individual pieces of a string can be accessed using an index, where the first character is stored in index 0.
  • Concatenate: Joining two or more strings together to make one longer string. To concatenate strings, use a + symbol between the two strings. Concatenating strings creates a new string which contains all of the original strings.
  • Integer: An integer is a positive or negative whole number. Integers should not be enclosed in quotation marks. Integers should be treated just like numbers and can be used in mathematical calculations.
  • Floating Point Number (Float): A float is a number with decimal precision and is always displayed with a decimal point. When you combine floats and integers in a mathematical calculation, the resulting answer will always be a float.
  • Boolean: A boolean is a value that is either True or False. In Python, the T and F in true and false must be capitalized. Boolean values are often used to create branching logic in programs.