Problem B and Solution

Coding Conundrum

Viktoria is writing a program that people can use to guess her favourite number, which is \(23\).

Use the following blocks to create pseudocode for Viktoria’s program. Note that you may not need to use all of the blocks.

say “That’s not correct.”

else

if guess \(\ne 23\)

say “That’s correct.”

say “Guess my secret number!”

if guess \(= 23\)

Using the additional blocks below, modify your pseudocode so that if the user’s guess is incorrect, then the program will tell them whether their guess is too high or too low.

say “That’s too low.”

else if guess \(< 23\)

say “That’s too high.”

if guess \(> 23\)

**Not printing this page?** You can use our interactive
worksheet.

Two possible solutions are shown below.

**Solution 1**say “Guess my secret number!”

if guess \(= 23\)

say “That’s correct!”

else

say “That’s not correct.”**Solution 2**say “Guess my secret number!”

if guess \(\ne 23\)

say “That’s not correct!”

else

say “That’s correct.”One possible solution is shown below.

say “Guess my secret number!”

if guess \(= 23\)

say “That’s correct!”

else if guess \(< 23\)

say “That’s too low.”

else

say “That’s too high.”