Check your understanding of the previous reading: sequential execution, statements and expressions.
True or false: normally, statements are executed from top to bottom.
Select one answer, then check.
Think of the reading's book metaphor: in which direction do you move through a page?
True or false: expressions are evaluated from left to right.
Select one answer, then check.
2 + 3 * 4 the multiplication is done before the addition, so the result is 14, not 20. Among operators with the same precedence, the leftmost one goes first: 10 - 4 - 3 is 3.2 + 3 * 4 the multiplication is done first, just like in math, but Python still reads the values 2, 3 and 4 from left to right.Work out 10 - 4 - 3 the way Python would. Does it calculate 10 - 4 first, or 4 - 3?
True or false: programs may execute very quickly in computers, but they always happen one step at a time.
Select one answer, then check.
Look back at the stopwatch picture in the reading: how long did each line of the program take?
Which of the following can be involved in an expression?
Select every correct answer, then check.
5, 10.0, True or "Hello", is an expression on its own.1 + 2 and 8 / 4 combine values into a new value.(1 + 5) > age, both 1 + 5 and age are expressions themselves.> and ==, and boolean operators such as and, or and not, combine values into True or False. The reading's 5 > 4 and False or not True are expressions.print, can contain expressions, but a statement is never part of an expression.age or score is an expression: it stands for the value stored in it.The reading lists what an expression can combine. Which option on this list is the thing that holds expressions, instead of being part of one?
(1 + 2) * 4 / 3
/ always gives a float, so the result is 4.0, even though 12 divides evenly by 3.1 + 2 + 3 + 4 + 5
15.(1 + 2) > 4
True or False. Here 3 > 4 is False."Hello " + "World"
"Hello World".4 > 5 or 5 == 6
False, and False or False is False.