Signed up recently but had issues with the confirmation email?
Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.
Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.
301.14 Random Number Generation
Practise exam questionsRandom Number Generation — Note 3 of 3
Avoid fencepost errors.
Off-by-one errors with random numbers happen when you use the wrong range boundaries. Remember that randint(a, b) includes both a and b.
randint(1, 6) includes both 1 and 6randint(0, 9) gives 10 possible values (0 through 9)range() which excludes the endimport random
# Want numbers 1 to 10 inclusive
num = random.randint(1, 10) # Correct: includes 10
# Common mistake with range:
# range(1, 10) gives 1-9 (excludes 10)
# randint(1, 10) gives 1-10 (includes 10)Back to Random Number Generation
Specification notes for programming are in Paper 2.