Practice

Validation Range Check

2023/May/Jun·Variant 3
EASYSelection

Ensure a length is between 15 and 35 inclusive. Output an initial prompt, then show an error and re-ask for each invalid input, until a valid value is entered.

Input: A sequence of integers. Output: Initial prompt, error messages for invalid inputs, then "Accepted".

Example:

Input:  10
        40
        20
Output: Enter a number between 15 and 35 inclusive
        Your number must be between 15 and 35 inclusive
        Your number must be between 15 and 35 inclusive
        Accepted
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Valid on first try
Inputs: 25
Expected: Enter a number between 15 and 35 inclusive Accepted
Test 2: Two invalid then valid
Inputs: 10, 40, 20
Expected: Enter a number between 15 and 35 inclusive Your number must be between 15 and 35 inclusive Your number must be between 15 and 35 inclusive Accepted
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade