Year 11
Lesson details
Key learning points
- In this lesson, we will be introduced to the concept of random numbers using Python documentation. We will determine what the random module is capable of, and how random numbers can be generated in Python. In computer science, random numbers are something that you are likely to use regularly. They are also used in areas such as cryptography, while pseudorandom numbers are used in video games, modelling, and simulations.
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...
4 Questions
Q1.
True or False: Pseudorandom number generation uses mathematical algorithms which are computer-generated and therefore highly predictable.
False
Q2.
If you want to comment on your code over multiple lines, what syntax should you use?
" " A single speech mark at the start and the end
# A hashtag at the start and another # at the end
Q3.
When using the function randrange(1,5,2), what is the third value in the brackets used for?
The maximum value
The minmum value
Q4.
When using the function randrange(1,5,2), what is the second value in the brackets used for?
The minmum value
The step value