0% found this document useful (0 votes)
10 views

Data Types Practice Worksheet

This worksheet from The Westminster School in Dubai focuses on computer science concepts for Year 7 students. It covers data types, including integer, string, float, and boolean, with exercises to identify and predict data types using Python code. Additionally, students are tasked with writing a short story incorporating variables of different data types.

Uploaded by

riannerepollo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Data Types Practice Worksheet

This worksheet from The Westminster School in Dubai focuses on computer science concepts for Year 7 students. It covers data types, including integer, string, float, and boolean, with exercises to identify and predict data types using Python code. Additionally, students are tasked with writing a short story incorporating variables of different data types.

Uploaded by

riannerepollo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

THE WESTMINSTER SCHOOL, DUBAI

COMPUTER SCIENCE
Term II, 2020-21
YEAR:07

Practice Worksheet:

Starting Activity
Find out where the name ‘Boole’ came from and what a ‘Boolean variable’ is. Write
your answer(s) in the space below:

Task 1 – Four Data Types


1. There are four types of data you need to know for your GCSE. You can find
out which data type a variable has by writing type(variable). Complete the
table below by copying and running each piece of code and writing down the
data type. The first one has been done for you:

Code Data type of Variable


str
str
Int
Float
(capital Bool
T!)

(capital Bool
F!)

2. The type function returns the data type of an expression.


For each of these expressions, first predict the data type then use the type
command to see if your prediction was correct.

Expression Predicted data type Type command Result ( √ or X


)
“hello world” str type("hello √
world")
False bool type(False) √
15 int type(15) √
35.6 float type(35.6) √
-999 float type(-999) X
“15” str type(“15”) √
“False” str type(“False”) √
True bool type(True) √
0.001 float type(0.001) √

3. Copy and run this code in the interactive shell.

4. In your own words, explain what the code does:

5. Complete this table to describe the four data types.


Python
Data
abbreviati Explanation Example
type
on

integer int

string str

float float

boolean bool

Hint: Quotation marks are used to show the start and end point of a string, e.g.
“this is a string”

Task 2 – Your Story


Write a short story using a number of variables (e.g. Hero, Villain, Location). Write
down the name of each variable below and the data type which it uses:

Variable Name Data Type Variable Name Data Type


Task 3 / Extension
Continue with your story. Try to include at least one string, one integer and one
floating data type in your variables (you will struggle to use Boolean).

You might also like