Which keyword is used for defining a function in Python?

2026

Which keyword is used for defining a function in Python?

  1. A.

    function

  2. B.

    method

  3. C.

    define

  4. D.

    def

Attempted by 354 students.

Show answer & explanation

Correct answer: D

The keyword used for defining a function in Python is def. This keyword introduces the function definition block.

Explore the full course: Rssb Senior Computer Instructor