Year 11
Lesson details
Key learning points
- In this lesson, we will develop our understanding of data validation by applying data validation through iteration.
Licence
This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.
Loading...
3 Questions
Q1.
What will be the output when this program is executed?
1, 2, 3, 4, 5
x, x, x, x, x
Q2.
When using the range() function. What is the first parameter used for? e.g. range(1, 11, 2)
The maximum value
The step or increment
The stop value
Q3.
When using the range() function. What is the second parameter used for? e.g. range(1, 11, 2)
The maximum value
The start value
The step or increment
3 Questions
Q1.
If the following code was used as a validation check on, how many times could a user enter incorrect data before the program had a runtime error?
1
There wouldn't be an error
Q2.
A user is asked to enter a number between 1 and 20. They enter 21. What type of validation error would this cause?
Empty string
It isn't an error because the value is within the specified range.
ValueError
Q3.
The following code is used as a validation check to ensure that a whole number is entered. On which line will the loop terminate?
not_validated = False
number = int(input())
print("You must enter a number")