# Check if given four integers (or sides) make rectangle in Python

Suppose we have a list of four sides, we have to check whether these four sides are forming a rectangle or not.

So, if the input is like sides = [10, 30, 30, 10], then the output will be True as there are pair of sides 10 and 30.

To solve this, we will follow these steps −

• if all values of sides are same, then
• return True
• otherwise when sides is same as sides and sides is same as sides, then
• return True
• otherwise when sides is same as sides and sides is same as sides, then
• return True
• otherwise when sides is same as sides and sides is same as sides, then
• return True
• return False

## Example

Let us see the following implementation to get better understanding −

Live Demo

def solve(sides):
if sides == sides == sides == sides:
return True
elif sides == sides and sides == sides:
return True
elif sides == sides and sides == sides:
return True
elif sides == sides and sides == sides:
return True
return False
sides = [10, 30, 30, 10]
print(solve(sides))

## Input

[10, 30, 30, 10]

## Output

True