# @property = Decorator used to define a method as a property (it can be accessed like an attribute) # Benefit: Add additional logic when you read, write, or delete attributes # Gives you a getter, setter, and deleter method class Rectangle: def __init__(self, width, height): self._width = width self._height = height @property def width(self): return f"{self._width:.1f}cm" @property def height(self): return f"{self._height:.1f}cm" @width.setter def width(self, new_width): if new_width > 0: self._width = new_width else: print("Width must be greater than zero") @height.setter def height(self, new_height): if new_height > 0: self._height = new_height else: print("Height must be greater than zero") @width.deleter def width(self): del self._width print("Width has been deleted") @height.deleter def height(self): del self._height print("Height has been deleted") rectangle = Rectangle(3, 4)
İm a full time dev now but i remember your react tutorial was very helpful when i was working on college assignments in the past, glad to see you're keeping it up still
thanks brogrammer edit: also this is a reminder that you should update pycharm or it will lose its charm (sorry I had to do it even tho this is second time)
# @property = Decorator used to define a method as a property (it can be accessed like an attribute)
# Benefit: Add additional logic when you read, write, or delete attributes
# Gives you a getter, setter, and deleter method
class Rectangle:
def __init__(self, width, height):
self._width = width
self._height = height
@property
def width(self):
return f"{self._width:.1f}cm"
@property
def height(self):
return f"{self._height:.1f}cm"
@width.setter
def width(self, new_width):
if new_width > 0:
self._width = new_width
else:
print("Width must be greater than zero")
@height.setter
def height(self, new_height):
if new_height > 0:
self._height = new_height
else:
print("Height must be greater than zero")
@width.deleter
def width(self):
del self._width
print("Width has been deleted")
@height.deleter
def height(self):
del self._height
print("Height has been deleted")
rectangle = Rectangle(3, 4)
İm a full time dev now but i remember your react tutorial was very helpful when i was working on college assignments in the past, glad to see you're keeping it up still
Please continue with python videos,very helpful ❤
Bro code is amazing....keep it up! I remember when u had 10k followers! Amazing
Hello mate i m still following your full python course which is great you re like an angel bro love you .
frfr
thanks brogrammer
edit: also this is a reminder that you should update pycharm or it will lose its charm (sorry I had to do it even tho this is second time)
Love your work Bro, keep them coming 😊
Hello !Are you planning to continue the JavaScript course?
Django backend framework tutorial plsssssssssssss
Bro please make a video on java spring boot
@BroCodez can you make c++ game developer pls
Bro bring adv java and spring boot course🗿
Bro can you upload react full tuts
The video could be half the length if you chose square instead of rectangle 😀
Bro please start backend course
Message for the algorithm!
WOOOOOOOOOOOOOOOOOOOO MORE PYTHON :ddddddddddddddddddddddddDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Bro ily UwU >
Bro can you convert your video in others language ❤
5th comment
I have a hard time understand thí