An Interest In:
Web News this Week
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
August 14, 2020 02:07 pm GMT
Original Link: https://dev.to/thepracticaldev/daily-challenge-281-area-or-perimeter-a4p
Daily Challenge 281 - Area or Perimeter
You are given the length and width of a 4-sided polygon. The polygon can either be a rectangle or a square.
If it is a square, return its area. If it is a rectangle, return its perimeter.
area_or_perimeter(6, 10)
--> 32area_or_perimeter(4, 4)
--> 16
Tests
area_or_perimeter(5, 5)
area_or_perimeter(10, 20)
Good luck!
This challenge comes from no one
on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!
Original Link: https://dev.to/thepracticaldev/daily-challenge-281-area-or-perimeter-a4p
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To