Parameter vs argument — same thing?

NoahLoopsOP

The example uses both words. Is there a difference?

3

Comments 4

Join the discussion

Already have an account? Log in

  1. HenryWritesreplies: 2

    - Parameter: the name in the function definition — def burn(fuel): → fuel is a parameter.
    - Argument: the actual value you pass in the call — burn(40) → 40 is an argument.

    People mix them up all the time and everyone understands, but that's the precise difference.

    4
      1. JackStack

        Yep, that error confused me until I realised it meant I forgot to pass a value.

        3
    1. Grace_42

      Error messages use them correctly, e.g. "missing 1 required positional argument", so it helps to know the difference.

      0