Getting confused with the name of elements of code
from bakery import assert_equal
from dataclasses import dataclass
@dataclass
class Rectangle:
length: int
width: int
def area(rect: Rectangle) -> int:
return rect.length * rect.width
box = Rectangle(5, 3)
assert_equal(area(box), 15)
I am getting confused which is function here and which is a class. What is the decorator here?
Can somebody please explain this in simple words?
5
6 comments
Vikas Dhuran
4
Getting confused with the name of elements of code
Data Alchemy
skool.com/data-alchemy
Your Community to Master the Fundamentals of Working with Data and AI — by Datalumina®
Leaderboard (30-day)
powered by