Lesson details
Key learning points
- In this lesson, we will understand the rules of operator precedence when evaluating arithmetic expressions. We will be reminded of BIDMAS, before investigating code that uses various arithmetic expressions. This lesson will prepare us for the next lesson, where we will begin to use conditions in programming.
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
4 Questions
Q1.
What is the evaluation of this expression: 10 * 10 / 5
100
2
50
Q2.
What is the evaluation of this expression: 5 - 2 + 6 / 2
3
4.5
9
Q3.
If you were using integer division, what would be the evaluation of this expression: 14//3
2
42
5
Q4.
If you were using modulo, what would be the evaluation of this expression: 14%3
1
3
42