Thursday , September 19 2024

Which one of the following lines properly starts a parameterless function definition?

Questions BankCategory: Python Essentials 1Which one of the following lines properly starts a parameterless function definition?
Which one of the following lines properly starts a parameterless function definition?

  • def fun():
  • function fun():
  • def fun:
  • fun function():

Explanation: The correct way to declare a function in Python is to use the reserved keyword def followed by the name of the function, parentheses () and a colon ‘:’. Since it is parameterless, the parentheses are empty.

More Questions: Python Essentials 1 – Module 4 Test