In this python if else program we will, take values of the length and breadth of a rectangle from the user and check if the shape is square or not.
Rectangle: A rectangle is a type of quadrilateral, whose opposite sides are equal and parallel.
Steps to solve the program
- Take the length and breadth of the rectangle as input.
- The area of the square is the side’s square and the area of a rectangle is length*breadth.
- Using an if-else statement check whether both of these values are equal or not.
- Print the respective output.
length = int(input("Enter length: "))
breadth = int(input("Enter breadth: "))
if length**2 == length*breadth:
print("It is a square")
else:
print("It is not a sqaure")
Output :
Enter length: 5
Enter breadth: 4
It is not a sqaure