← Back to Menus & Validation
Question 448
Guess The Secret Number
Guess The Secret Number
The secret number is 42, declared at the top (no random numbers). Read guesses with the prompt Guess: until one matches. After each wrong guess print Higher! when the guess is below the secret or Lower! when it is above, and print Correct! once the guess matches. Input: one whole number per line; the last line is 42. The prompt is part of the output, so each message follows its prompt on the same line.
Expected Output:
Guess: Higher! Guess: Lower! Guess: Correct!
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Menus & Validation
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.