The player has to keep inputting 4 digit numbers until they guess
the random one. (Complete)
After each unsuccessful try it should say how many numbers they
got correct but not which ones. (Complete)
At the end of the game it should congratulate the user and say
how many tries it took. (Complete)
Pseudo Code
GUESSED = False
While GUESSED= False:
NUMBER = INPUT(Welcome to guess the number, Please enter your guess)
IF (NOT LEN(NUMBER) == 4):
Print(please enter a four digit number)
ELSE:
1 is added to the GUESSES
IF(NUMBER = STR(MYNUMBER)):
PRINT(Well done! You have guessed the number in + STR(guesses) + Guesses)
ELSE:
FOR INT IN digits:
IF STR(INT) IN STR(NUMBER) AND STR(MYNUMBER):
Variable Table
Identifier
Data Type
Description
Validation
Guesses
String
myNumber
String
Digits
Integer
Guessed
String
Build of my code
I imported a random
number so that can be
guessed by the user.
This generates a
random number
between 1000,9999 so
it is a 4 digit number
to guess.
Build of my code 2
Build of my code 2
Problems
I over came some tricky tasks especially how to create a system to tell
the user how many numbers they have got correct. I overcame this by
testing my code many time and using trial and error to work it out.
This is the
part of the
code that I
didnt
understand.
I overcame
this by trying
many times
Test Table
Test
Number
Test
Description
Test Data
Expected
Result
Errors?
Evidence
Displays how
many digits are
correct
yes
Next slide
Generates a
random 4
digit number
No
Display an input
so that the user
can input a 4
digit number
number =
The user will
input(Welcom input a 4 digit
e to guess the number
number,
Please enter
your guess:)
No
Congratulate
the user when
they get the
number correct
Yes
Congratulates
user and tells
them the
number of
guesses
Test 1 Evidence
Test 2
Evidence
These show the digits that are
correct. This shows us that a
random number has been imported.
Test 3
Evidence
Test 4
Evidence
Testing
myNumber has been set
to 9324 for testing
reasons.
Evaluation