Check your understanding of the previous reading: evaluating expressions versus printing them, and the interactive-console (REPL) concept.

Question 1

Evaluate the following expression:

(1 + 2) * (3 + 4)

Show explanation

1 + 2 evaluates to 3, and 3 + 4 evaluates to 7. Then 3 * 7 evaluates to 21.

Question 2

What will happen when the following code is run as a program, the normal way (not evaluated on an interactive console)?

400 / 2

Select one answer, then check.

  • Correct. 400 / 2 is evaluated to 200.0, but since there is no print, the result is thrown away and nothing appears in the console.
  • Not quite. 400 / 2 is completely valid Python syntax — it's just an expression.
  • Not quite. Dividing two numbers is a perfectly valid operation; nothing here is semantically wrong.
  • Not quite. Without a print statement, running this as a saved program does not show the result anywhere.

Question 3

Now imagine typing the very same expression directly into an interactive console (a REPL), instead of running it as a program. What happens?

400 / 2

Dodona itself has no interactive console — this checks the concept from the reading. Select one answer, then check.

  • Correct. An interactive console evaluates the expression and automatically shows you the result, with no print needed.
  • Not quite. The expression is valid Python; nothing here would cause a syntax error.
  • Not quite. Dividing two numbers is a valid operation.
  • Not quite — that's what happens when you run this as a saved program. An interactive console shows the value automatically.

Question 4

Which of the following statements are true about the interactive console?

Select every true statement, then check.

  • True. A program does not display the value of an expression on its own, so you need print to show it. An input prompt is written to the console too, but that is the prompt, not the value of an expression.
  • True. On an interactive console, evaluating an expression shows its value automatically, without needing print.
  • False. Running a saved program does not automatically print every expression's value — only what's explicitly passed to print appears.
  • False. A program with no print calls at all still runs from start to finish; it simply produces no console output.

Question 5

Match each term to its definition:

TermDefinition
Console
Evaluate
Shell
Run
Print