Skip to content

2018-5: What's Your Sign? Revisited

In Western astrology, the Zodiac is based on twelve 30° sectors of the ecliptic. Although the exact dates in a given year may shift by a day, the general dates for each sign are:

| | | | |- |Aries|March 21–April 19|Libra|September 23–October 22| |- |Taurus|April 20–May 20|Scorpio|October 23–November 21| |- |Gemini|May 21–June 20|Sagittarius|November 22–December 21| |- |Cancer|June 21–July 22|Capricorn|December 22–January 19| |- |Leo|July 23–August 22|Aquarius|January 20–February 18| |- |Virgo|August 23–September 22|Pisces|February 19–March 20|

Write an APL function that, given a 2-element integer vector representing month and day, returns a character vector (string) of the corresponding Western zodiac sign.

Examples:

     (your_function) 2 23    ⍝ February 23
Pisces
     (your_function) 10 31   ⍝ October 31
Scorpio
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub