← Back to Menus & Validation
Question 462
Higher Or Lower With Attempts
Higher Or Lower With Attempts
The secret number is 57, declared at the top (no random numbers). Inside a while True loop read a guess with the prompt Guess: as an int and count it in attempts. A guess equal to the secret prints Correct! and then Guesses: <n> on the next line and leaves the loop; a lower guess prints Higher!; a higher guess prints Lower!. Input: one whole number per line; the last line is 57. 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! Guesses: 3
= 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.