A

Admin • 833.24K Points
Coach

Q. What is the role of @property in Python classes?

  • (A) To create private members
  • (B) To convert method to a read-only attribute
  • (C) To create a class method
  • (D) To define a constructor
  • Correct Answer - Option(B)
  • Views: 31
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

The @property decorator allows a method to be accessed like an attribute.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.