logo

AQA A-Level Computer Science practice

Explain how parameters allow the following Python subroutine to be reused with different data. Include two example calls and the value printed by each call. ```python def showDifference(first, second): print(first - second) ```

Try the question first, then check the answer and practise the same topic again.

At a glance

Question

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

Explain how parameters allow the following Python subroutine to be reused with different data. Include two example calls and the value printed by each call. ```python def showDifference(first, second): print(first - second) ```.

Answer and explanation

Concise answer

The parameters `first` and `second` act as named places for data supplied when the subroutine is called.

Why this is correct

Parameters separate the subroutine's instructions from the particular data being processed. Each call supplies new argument values, which are used by the same calculation.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions