Computing
Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Lesson Video

12

Lesson Tasks

  • Watch the Lesson video
    Make notes if needed.
  • Open your Learning Journal
    Complete Task 1 in your Learning Journal
  • Complete the learning activities
    Make sure you complete the book tasks in your Unit Booklet
  • Complete End of Task Assessment
    Update your learning objectives

What do I need to Learn?

0 results forGuest
I need to learn how to understand the concept of a data type.
I need to learn how to understand and use an integer appropriately.
I need to learn how to understand and use a real appropriately.
I need to learn how to understand and use a Boolean appropriately.
I need to learn how to understand and use a character appropriately.
I need to learn how to understand and use a string appropriately.

Key Terms

Data Typels Integer Float Boolean Character String Type mismatch error Casting.

Task 1 - Getting organised Click to see more


Task: Learning Journal

Open your Learning Journal by clicking on the image below

Good notes will help you organise and process data and information

Task 1: Fill out your learning Journal.

Open your Learning Journal and complete the task below .


Task 2 - What are data types? Click to see more

The purpose of data types within code

Data can be stored in many different forms and the proper term for these forms is ‘data types’. A computer uses special internal codes to keep track of the different types of data it processes. Most programming languages require the programmer to declare the data type of every data object.

The most common data types you will have used are called primitive data types.

Primitive data types are predefined types of data that are supported by the programming language.


Data types diagram

Data types

Table of the most common data types

Data type Example Size
Integer (whole number) 4, 27, 65535 1 to 8 bytes
Real (decimal number) 4.2, 27.4, 5.63 4 to 8 bytes
Character a, F, 3, $, £, # 1 byte
String abc, hello world Limited to the amount that can be stored in main memory
Boolean true or false 1 bit

Task 2:

Open your Learning Journal and complete the task below .



Task: Data types

Answer the following questions .

  1. What data type is included in the table, but missing from the primitive data types diagram and why?
  2. Why do computer languages use data types?
  3. Why do you think python is called a dynamically typed language?

  • Complete the above questions in your Learning Journal


  • Task 3 - Using data types Click to see more

    Task: Using Data types

    Open your student workbook at page 7 read through the notes on pages 7 & 8 and then complete Tasks 1 and 2 on pages 9 & 10 .



    Task 4 - Casting data types Click to see more

    Integer

    In python when we want to convert a variable (cast) to an integer data type we would do the following:

    variable = int(variable)


    Real

    In python when we want to convert a variable (cast) to a real data type we would do the following:

    variable = float(variable)

    String

    In python when we want to convert a variable (cast) to a string data type we would do the following:

    variable = string(variable)

    Boolean

    The Boolean data type represents the values of true / false or yes / no. The primitive data type of a Boolean is logical. Boolean logic is a type of mathematical comparison. It is used to evaluate true or false. This may be new to you but it is not difficult to understand. Think about binary numbers. The lights could be on = 1 or off = 0.

    Boolean logic evaluates every expression to either true or false.

    Casting a variable to a bool can be problematic so we will not be doing that at GCSE.


    Task: Casting Data types

    Get a user to input a number then show how you would change its data type to an integer and then a floating point number .

    We can use the type() function to know what the data type of a variable is.

    Type Example

    a = 7
    print(a, "is of type", type(a))
    b = 3.14
    print(b, "is of type", type(b))
    c = "Hello World"
    print(c, "is of type", type(c))

    Task 5 - A recap Click to see more

    Task: Data types

    Complete the table below giving th4e correct data types to the data .


    Final Recap

    Open your student workbook at page 11 and complete task 3

    Task 6 - Lesson Review Click to see more


    Summing it all up

    Lets look at the learning outcomes and decide which one best describes our current level of understanding :

    Tick the one you feel is closest to your level

    Learning Outcomes I need to learn how to understand the concept of a data type.

    • I have a basic understanding of how I can understand the concept of a data type. with a little help from my teacher
    • I can show my teacher that I can understand the concept of a data type. without their help.
    • I can understand the concept of a data type. independently and I can also explain it to others and can complete any extension tasks I am given.

    🠜 Now update your learning objectivesClick on the Assessment image

    Task 7 - Homework Click to see more


    Complete any unfinished tasks