Skip to main content

Back to the full dot-point answer

SingaporeComputer ScienceQuick questions

Programming in Python

Quick questions on Python functions and procedures explained: O-Level Computing

6short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is defining a function?
Show answer
You define a function with def, a name, and a list of parameters in brackets. The indented block below is the function body:
What is returning a value?
Show answer
A function can send a result back with return. The returned value can be stored or used in an expression:
What are wrong number of arguments?
Show answer
The call must supply a value for each parameter, or Python raises an error.
What is q1?
Show answer
State the difference between a parameter and an argument. [2 marks]
What is q2?
Show answer
Write a function double(n) that returns twice its input. [2 marks]
What is q3?
Show answer
Give one benefit of writing code as a function rather than repeating it. [2 marks]

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages