Python implements the method of getting constellations by month and date
- 2020-04-02 14:45:43
- OfStack
This article illustrates how python implementations get constellations by month and date. Share with you for your reference. The specific implementation method is as follows:
# Calculation of the constellation
def Zodiac(month, day):
n = (u' Capricorn ',u' Aquarius: ',u' Pisces ',u' Aries ',u' Taurus ',u' Gemini ',u' cancer ',u' Leo ',u' virgo ',u' libra ',u' Scorpio ',u' Sagittarius ')
d = ((1,20),(2,19),(3,21),(4,21),(5,21),(6,22),(7,23),(8,23),(9,23),(10,23),(11,23),(12,23))
return n[len(filter(lambda y:y<=(month,day), d))%12]
Zodiac(3,14)
I hope this article has helped you with your Python programming.