Positional and Default Parameters in Python Functions (Class 12 Computer Science)
Updated 16 October 2026 · Fact-checked
Parameters are the names in a function header; arguments are the values passed in a call. Positional parameters receive arguments in order, so the count must match. A default parameter, such as rate=8, takes its default when no argument is given. Default parameters must come after all parameters without defaults.
Arguments fill parameters left to right; any parameter left without an argument uses its default, so defaults must come last.
Illustration drawn for QuestionBuddy.
Understand Positional and Default Parameters
In def interest(p, r, t): the names p, r and t are parameters (also called formal parameters). In the call interest(1000, 8, 2) the values 1000, 8 and 2 are arguments (actual parameters). When the function is called, each parameter is bound to an argument and then behaves like a local variable (NCERT Class XI 7.3.2).
Positional parameters. Arguments are matched to parameters by position: the first argument to the first parameter, and so on. Two things follow:
- The order matters.
info(16, 'Ria')fordef info(name, age)makes name 16 and age 'Ria'. Python does not complain; the output is simply wrong. - The number must match. Too few arguments raises
TypeError: f() missing 1 required positional argument: 'b'; too many raisesTypeError: f() takes 2 positional arguments but 3 were given.
Default parameters. A parameter can be given a value in the header: def interest(p, r=8, t=1):. If the call supplies an argument for it, that argument is used; if not, the default is used. So interest(1000) uses r = 8 and t = 1, interest(1000, 10) uses r = 10 and t = 1, and interest(1000, 10, 2) uses all three arguments. Defaults make a function flexible: common cases need fewer arguments.
The trailing rule. Because arguments are matched left to right, once a parameter has a default, every parameter to its right must also have one. def f(a, b=1, c=2) is valid; def f(a=1, b) is a SyntaxError (Python 3.12 says 'parameter without a default follows parameter with a default'). NCERT states it as: default parameters must be the trailing parameters.
Arguments of different types. An argument can be a number, string, list, tuple or dictionary. If a list is passed and the function changes its contents (append, item assignment), the caller sees the change, because parameter and argument name the same list. Passing an int or string cannot change the caller's variable, because those are immutable.
The syllabus wording is 'arguments and parameters, default parameters, positional parameters'. Board items ask you to pick the valid header, predict the output of calls that use some defaults, or write a function with a default parameter, such as a 2-3 mark program in which a value like a rate or a separator has a default.
Positional and Default Parameters: key facts
- Terms
Parameter name in the function header (formal parameter) Argument value given in the call (actual parameter) Positional parameter gets the argument at the same position Default parameter has a value in the header, used when no argument is given - Parameters are local variables of the function.
- Matching rule
- interest(1000) → p = 1000, r = 8, t = 1
- interest(1000, 10) → r = 10, t = 1
- interest(1000, 10, 2) → r = 10, t = 2
- For def interest(p, r=8, t=1); arguments fill parameters left to right.
- Valid and invalid headers
def f(a, b=1, c=2) valid def f(a, b, c=2) valid def f(a=1, b) SyntaxError def f(a=1, b, c=2) SyntaxError - Defaults must be the trailing parameters.
- Errors from a wrong number of arguments
Too few TypeError: missing required positional argument Too many TypeError: takes n positional arguments but m were given Wrong order no error, wrong result - Read the error type carefully in MCQs: these are TypeErrors, not SyntaxErrors.
How to answer Positional and Default Parameters questions
For output questions with parameters, match every argument before running the body.
- 1Write the header and list the parameters with their default values, if any.
- 2For each call, fill the parameters from left to right with the arguments given.
- 3Any parameter left without an argument takes its default; if it has no default, the call raises TypeError (missing argument).
- 4If there are more arguments than parameters, the call raises TypeError (too many arguments).
- 5Run the body with these values; remember that parameters are local.
- 6For header-validity MCQs, check that no parameter without a default comes after one with a default.
- 7In programs you write, put the parameters the question says are optional at the end with sensible defaults.
Positional and Default Parameters in real life
The idea, met in an everyday situation. Answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.
Default parameters for the common case
Suppose a cinema's ticket function charges ₹200 per seat unless the customer picks a premium seat, and books 1 seat unless told otherwise.
Write ticket(name, seats=1, rate=200) that returns a message with the total, and show three calls: only a name; a name and 3 seats; a name, 2 seats and rate 350.
Try it first, then show the solutionSolution
- Only the name is required, so it comes first; the optional values come last with defaults.
def ticket(name, seats=1, rate=200): return name + ': Rs ' + str(seats * rate) print(ticket('Kabir')) print(ticket('Meera', 3)) print(ticket('Joel', 2, 350))
Answer: Kabir: Rs 200
Meera: Rs 600
Joel: Rs 700
Memory hook: Defaults are the 'usual order' at a shop: say nothing and you get the usual.
Positional order matters
Imagine a form-printing function label(name, city) used to print parcel labels, and a clerk types label('Pune', 'Asha') by mistake.
What is printed, and does Python report an error?
Try it first, then show the solutionSolution
- Arguments match by position: name = 'Pune', city = 'Asha'.
def label(name, city): print('To:', name, '| City:', city) label('Pune', 'Asha') label('Asha', 'Pune')
Answer: To: Pune | City: Asha (no error, just a wrong label); the correct call prints To: Asha | City: Pune.
Memory hook: Positional arguments are seats in a row: whoever sits in seat 1 is called 'name'.
Tricks to remember Positional and Default Parameters
Short memory aids. Say each one aloud once, then use it on a question the same day.
Header has Parameters, call has Arguments
P for Plan (header), A for Action (call).
Use it when: Defining the two terms.
Defaults sit at the back of the bus
Once someone with a default sits down, everyone behind must have a default too.
Use it when: Valid-header MCQs.
Fill from the left
Arguments fill seats from the left; empty seats take their default or cause a TypeError.
Use it when: Predicting values in partial calls.
Count errors are TypeErrors
Wrong number of arguments: TypeError at the call. Wrong header order: SyntaxError before anything runs.
Use it when: Error-identification items.
Positional and Default Parameters: solved examples
Ordered from board level to HOTS. Try each one before you open the solution.
Example 1: Calls that use some defaults · 1 mark · Very short answerBoard level
Write the output:
def interest(p, r=8, t=1):
return p * r * t / 100
print(interest(1000), interest(1000, 10), interest(1000, 10, 2))Try it first, then show the solutionSolution
- First call: r = 8, t = 1 → 80.0. Second: r = 10, t = 1 → 100.0.
- Third: r = 10, t = 2 → 200.0. / always gives a float.
Answer: 80.0 100.0 200.0
Example 2: Which header is valid? · 1 mark · MCQHarder board level
Which of the following function headers is valid in Python?
(a) def area(l=5, b): (b) def area(l, b=5): (c) def area(l=5, b, h=2): (d) def area(=5, b):
Try it first, then show the solutionSolution
- (a) and (c) put a parameter without a default after one with a default: SyntaxError.
- (d) is not a parameter at all. Only (b) has its default at the end.
Answer: (b) def area(l, b=5):
Example 3: Wrong order, no error · 2 marks · Short answerHarder board level
Predict the output:
def info(name, age=15):
print(name, 'is', age)
info('Ria')
info(16, 'Ria')Try it first, then show the solutionSolution
- info('Ria'): name = 'Ria', age takes its default 15. (1 mark)
- info(16, 'Ria'): matched by position, so name = 16 and age = 'Ria'; Python prints them without complaint. (1 mark)
Answer: Ria is 15
16 is Ria
Example 4: Writing functions with defaults · 3 marks · Short answerHarder board level
Write a function power(base, exp=2) that returns base raised to exp, and a function line(ch='-', n=10) that prints ch n times. Show the output of power(5), power(2, 5), line() and line('*', 4).
Try it first, then show the solutionSolution
- Headers with trailing defaults (1 mark); return in power and print in line (1 mark); correct calls (1 mark).
def power(base, exp=2): return base ** exp def line(ch='-', n=10): print(ch * n) print(power(5), power(2, 5)) line() line('*', 4)
Answer: 25 32
----------
****
Example 5: Identify the error in each call · 2 marks · Short answerHOTS / competency
For def avg(a, b, c=0): return (a + b + c) / 3, state the result or the error of each call: (i) avg(3, 6) (ii) avg(3) (iii) avg(3, 6, 9, 12)
Try it first, then show the solutionSolution
- (i) c defaults to 0: (3 + 6 + 0) / 3 = 3.0. (½ mark)
- (ii) b has no default and no argument: TypeError: avg() missing 1 required positional argument: 'b'. (½ mark)
- (iii) Four arguments for three parameters: TypeError: avg() takes from 2 to 3 positional arguments but 4 were given. (1 mark)
def avg(a, b, c=0): return (a + b + c) / 3 print(avg(3, 6)) try: avg(3) except TypeError as e: print(e) try: avg(3, 6, 9, 12) except TypeError as e: print(e)
Answer: (i) 3.0 (ii) TypeError: missing 1 required positional argument: 'b' (iii) TypeError: takes from 2 to 3 positional arguments but 4 were given
Example 6: Case study: a shop's bill function · 4 marks · Case-basedHOTS / competency
Suppose a stationery shop writes bill(price, qty=1, disc=0) that returns price × qty reduced by disc percent.
(i) Write the function. (2 marks)
(ii) Give the outputs of bill(50), bill(50, 4) and bill(50, 4, 10). (1 mark)
(iii) The owner wants the discount to be required and the quantity optional, and writes def bill(price, qty=1, disc). Why is this rejected, and what is a valid header? (1 mark)
Try it first, then show the solutionSolution
- (i)
def bill(price, qty=1, disc=0): amt = price * qty return amt - amt * disc / 100 print(bill(50), bill(50, 4), bill(50, 4, 10)) - (ii) 50.0, 200.0 and 180.0 (the / makes each result a float).
- (iii) disc has no default but comes after qty, which has one: SyntaxError. Put the required parameter first: def bill(price, disc, qty=1).
Answer: (ii) 50.0 200.0 180.0 (iii) A non-default parameter cannot follow a default one; use def bill(price, disc, qty=1).
Where students lose marks in Positional and Default Parameters
The slips examiners see most often, and what to write instead.
Mistake: Putting a default before a required parameter
Arguments fill from the left, so Python rejects a required parameter after a default one.
Wrong working
def total(rate=5, amount):
Right working
def total(amount, rate=5):
Do this: List required parameters first, then the ones with defaults.
Usually costs: Half to 1 mark.
Mistake: Mixing up parameters and arguments
The terms are defined by where they appear: header or call.
Wrong working
In def area(l, b), l and b are arguments.
Right working
In def area(l, b), l and b are parameters; in area(4, 7), 4 and 7 are arguments.
Do this: Give the definition with a two-line example marking each.
Usually costs: 1 mark.
Mistake: Assuming Python reorders positional arguments
Without keywords, arguments go strictly by position.
Wrong working
info(16, 'Ria') → Ria is 16
Right working
info(16, 'Ria') → 16 is Ria
Do this: Match each argument to the parameter in the same position.
Usually costs: 1 mark.
Mistake: Calling the argument-count error a SyntaxError
A wrong number of arguments is detected when the call runs, as TypeError.
Do this: SyntaxError: badly written header or code. TypeError: wrong number of arguments at a call.
Usually costs: 1 mark in MCQs.
Exam tips
- When a question says a value is 'optional' or 'by default ...', make it a default parameter at the end of the header.
- Show at least one call that uses the default and one that overrides it; examiners look for both.
- In MCQs on headers, check only one thing: is every parameter after the first default also given a default?
- If a list is passed and changed inside the function, the caller's list changes too; mention this when explaining outputs.
- Use the syllabus words in definitions: 'positional parameters', 'default parameters', 'arguments and parameters'.
Practice questions on Positional and Default Parameters
Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.
Q1 · 1 mark · MCQBoard level
The values passed to a function at the time of calling it are called:
(a) parameters (b) arguments (c) defaults (d) returnsHint
Header or call?
Answer
(b) arguments
Q2 · 1 mark · Very short answerBoard level
Write the output:
def f(x, y=3): return x * y print(f(2), f(2, 5))Hint
The first call uses the default.
Answer
6 10
Q3 · 1 mark · Very short answerBoard level
In the code below, name the parameters and the arguments.
def area(l, b): return l * b print(area(4, 7))Hint
P for Plan, A for Action.
Answer
Parameters: l and b. Arguments: 4 and 7. Output 28.
Q4 · 2 marks · Short answerHarder board level
Write the output:
def wish(n, msg='Good morning'): return msg + ', ' + n print(wish('Tara')) print(wish('Good night', 'Tara'))Hint
The second call fills n first.
Answer
Good morning, Tara
Tara, Good nightQ5 · 2 marks · Short answerHarder board level
Write a function percent(marks, total=500) that returns the percentage rounded to 2 decimal places with round(). Print percent(437) and percent(72, 80).
Hint
round(value, 2).
Answer
def percent(marks, total=500): return round(marks / total * 100, 2) print(percent(437), percent(72, 80))Output: 87.4 90.0
Q6 · 1 mark · Assertion-reasonHarder board level
Assertion (A): def f(a=2, b): is an invalid function header.
Reason (R): A parameter without a default value cannot follow a parameter with a default value.
(a) Both A and R are true and R is the correct explanation of A. (b) Both A and R are true but R is not the correct explanation of A. (c) A is true but R is false. (d) A is false but R is true.Hint
Back of the bus.
Answer
(a) Both are true and R explains A.
Q7 · 2 marks · Short answerHOTS / competency
Predict the output:
def add(L, x=0): L.append(x) return len(L) M = [1] print(add(M), add(M, 5), M)Hint
The list argument is the caller's list; the calls run left to right before printing.
Answer
2 3 [1, 0, 5]. The first call appends the default 0, the second appends 5, and both change M.
Test your recall
Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.
1.What is a default parameter?Show answer
A parameter given a value in the header, used when the call gives no argument for it.
2.Is def f(a, b=2, c=3) valid?Show answer
Yes; the defaults are at the end.
3.What error does calling f(1) give for def f(a, b)?Show answer
TypeError: f() missing 1 required positional argument: 'b'.
4.What does def f(a=1, b) give?Show answer
SyntaxError: parameter without a default follows parameter with a default.
5.How are positional arguments matched?Show answer
By order: first argument to first parameter, and so on.
6.What is another name for a parameter?Show answer
Formal parameter (an argument is also called an actual parameter).
Positional and Default Parameters: frequently asked questions
What is the difference between an argument and a parameter?
A parameter is a name in the function header, such as l and b in def area(l, b). An argument is the value supplied in the call, such as 4 and 7 in area(4, 7).
Why must default parameters come at the end?
Arguments are matched from the left. If a required parameter came after a default one, Python could not tell which argument belongs where, so the header is a SyntaxError.
Are keyword arguments in the Class 12 CBSE syllabus?
The 2026-27 syllabus names arguments and parameters, positional parameters and default parameters. Board questions on this topic use positional calls and defaults, so practise those first.
Can a list be passed as an argument?
Yes. Any object can be passed. If the function changes the list's contents, the caller's list changes too, because both names refer to the same list.