Number of sides on a polygon [FINALIZED]
+0
−0
Now posted: Number of sides on a polygon
Input
- The name of a polygon.
- You are only required to handle inputs listed in the test cases.
Output
- The number of edges the polygon has.
Test cases
Test cases are in the format input : output.
triangle : 3
trigon : 3
quadrilateral : 4
quadrangle : 4
tetragon : 4
rectangle : 4
square : 4
rhombus : 4
parallelogram : 4
kite : 4
trapezium : 4
pentagon : 5
hexagon : 6
heptagon : 7
septagon : 7
octagon : 8
enneagon : 9
nonagon : 9
decagon : 10
hendecagon : 11
undecagon : 11
dodecagon : 12
triskaidecagon : 13
tridecagon : 13
tetrakaidecagon : 14
tetradecagon : 14
pentakaidecagon : 15
pentadecagon : 15
hexakaidecagon : 16
hexadecagon : 16
heptakaidecagon : 17
heptadecagon : 17
octakaidecagon : 18
octadecagon : 18
enneakaidecagon : 19
enneadecagon : 19
icosagon : 20
Scoring
This is a code golf challenge. Your score is the number of bytes in your code. Lowest score for each language wins.
Explanations are optional, but I'm more likely to upvote answers that have one.

0 comment threads