Slip 26 - A) Write an anonymous function to find area of square and rectangle.

Solution :

areaSquare=lambda length : length * length
areaRect=lambda length,width : length * width

l=int(input("Enter Length of Square: "))
print("Area of Square:",areaSquare(l))

l=int(input("\nEnter Length of Rectangle:"))
w=int(input("Enter Width of Rectangle: "))
print("Area of Rectangle:",areaRect(l,w))


Output:

Output_pic


Post a Comment

0 Comments