Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Rectangle Perimeter by mortonfox
def rectangle_perimeter(length: int, width: int) -> int:
return 2 * (length + width)
print("Example:")
print(rectangle_perimeter(3, 2))
# These "asserts" are used for self-checking
assert rectangle_perimeter(2, 4) == 12
assert rectangle_perimeter(3, 5) == 16
assert rectangle_perimeter(10, 20) == 60
assert rectangle_perimeter(7, 2) == 18
assert rectangle_perimeter(1, 1) == 4
assert rectangle_perimeter(1, 5) == 12
assert rectangle_perimeter(4, 1) == 10
assert rectangle_perimeter(100, 100) == 400
assert rectangle_perimeter(0.5, 2) == 5
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 11, 2023
Comments: