CLCODING
عکس
Python Coding Challenge — Day 1247
Can you predict the output of this Python code?
Today's challenge tests your understanding of Python OOP, the @ property decorator, and attribute access.
class A:
def init(self):
self.x = 10
@ property
def x(self):
return 20
a = A()
print(a.x)
What will be the output?
A) 10
B) 20
C) None
D) Error
Think carefully before answering! The interaction between @ property and attribute assignment is the key to solving this challenge.
Comment your answer (A, B, C, or D) before checking the solution.
Answer & Explanation:
https://www.clcoding.com/2026/10/python-coding-challenge-day-1247-what.html
Follow @pythonclcoding for daily Python challenges, coding tips, and interview preparation.
❤1
167 ·