You are on page 1of 3

8.4.

4 Worksheet A

The lines of code below are for a


program that asks a user to enter
a number between 1 and 10, and
then tells them whether their
number is smaller than, larger
than or the same as the
computer’s number. The
computer’s number is coded into
the program and cannot be
changed.

1 Decide the order in which the lines


need to be written for the program
to run successfully. There may be
more than one correct answer.
Line Python code
number

1-2

2-1

(see next question, below)


2 Rewrite the code as pseudocode below
(you can check example of correct
pseudocode):

START
CONST COMPNUM = 7
INPUT userNUM
IF userNUM > COMPNUM
OUTPUT“your number is the biggest”
EXIT
ELIF userNUM < COMPNUM
OUTPUT”your number is the smallest”
EXIT
ELSE
OUTPUT”both numbers are equal”
EndIf

3 Rewrite the code as a flowchart


algorithm (using draw.io) and put a
screenshot of it below.

Copy-paste your screenshot below:


EXTENSION:

1. Code the program on


TutorialsPoint.com online python
compiler and a screenshot below.
Copy your code below:

2. Test your program using a test


plan.

Test Input data E_____ O______ Pass/fail


Number
1 7 equal pass
2 8 biggest pass
3 3 smallest pass

You might also like