Robotics & Artificial Intelligence

Which of the following statements is the most appropriate for Python function?

  1. A block of code that only runs when it is called
  2. A variable used to store data
  3. A way to print output to the console
  4. An error message

Python Functions

1 Like

Answer

A block of code that only runs when it is called

Reason — A Python function is a block of reusable code designed to perform a specific task. It is executed only when it is called (invoked) from the main program or from another function.

Answered By

3 Likes


Related Questions