Skip to content
Exercises · Q6

Q.Differentiate between following with the help of an example:

a) Argument and Parameter
b) Global and Local variable
Yanam BieapTextbookSubjective· 3mImportance★★★★★est
60% · 24/40 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Parameter = the stand-in name written in the function header; argument = the actual value supplied in the call. Global variable = defined outside every function, visible program-wide; local variable = defined inside a function, alive only during that call.

The idea. Both pairs describe the two sides of a boundary. Parameter/argument is the boundary of a function call (definition side vs call side); global/local is the boundary of a function's scope (outside vs inside).

a) Argument vs Parameter

def area(length, breadth):      # length and breadth are PARAMETERS
    return length * breadth

print(area(6, 4))               # 6 and 4 are ARGUMENTS
side = 5
print(area(side, side))         # the current value of side (5) is the argument

Expected output

24
25
ParameterArgument
Where it appearsfunction definition headerfunction call
What it isa variable name (a stand-in)an actual value/expression
Example abovelength, breadth6, 4, side
When it gets a valueat call time, from the matching argumentalready has one

When area(6, 4) executes, the argument 6 is bound to the parameter length and 4 to breadth, positionally.

b) Global vs Local variable

city = "Delhi"                  # GLOBAL: defined outside all functions

def show():
    pin = 110001                # LOCAL: created when show() starts
    print(city, pin)            # a function may READ a global freely

show()
print(city)                     # global still accessible here
print(pin)                      # NameError! pin died when show() returned

Expected output

Delhi 110001
Delhi
Traceback (most recent call last):
  ...
NameError: name 'pin' is not defined

| | Global variable | Local variable |

|---|---|---| …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.