A Read-Only property Still Blocks Writes
class Temperature:
def __init__(self, celsius):
self._celsius = celsius
@property
def fahrenheit(self):
return self._celsius * 9 / 5 + 32
t = Temperature(0)
print(t.fahrenheit)
t.fahrenheit = 100
What happens on the last line?
Sign in to answer questions and track your progress
Sign In