Shape Formula
Sometimes the formula depends on which shape you are dealing with: a square or a regular rectangle. Write a function area_or_perimeter that takes the sides l and w. If the sides are equal, return the area; otherwise, return the perimeter.
Примеры
Ввод
4, 4Вывод
16Ввод
6, 10Вывод
32Ввод
3, 3Вывод
9Нужно реализовать
def area_or_perimeter(l: int, w: int) -> int:
Теги
math
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
4, 4Expected
162
Input
6, 10Expected
323
Input
3, 3Expected
94
Input
1, 2Expected
65
Input
5, 5Expected
256
Input
-100, 4Expected
-192Focus radio
Paused · SomaFM · Fluid