Sep-12-2020, 12:34 PM
I am trying to check if the sum of all 3 sides of triangle is equal to 180 , if it is then it should output true else false,
I am using lamba function to implement it, as i want some practice.
This is what i tried i am getting output as
My code here:
I am using lamba function to implement it, as i want some practice.
This is what i tried i am getting output as
<function __main__.Triangle.check_angles.<locals>.<lambda>>instead i should be getting True or False, i really wanna use lamba here, do let me know what i am missing, thanks a lot in advance.
My code here:
class Triangle(): def __init__(self, angle1, angle2, angle3): self.angle1=angle1 self.angle2=angle2 self.angle3=angle3 self.number_of_sides=3 def check_angles(self): return (lambda self:'True' if (self.angle1+self.angle2+self.angle3)==180 else 'False') cal=Triangle(45,45,90) cal.check_angles()