I am creating a dating site in Django / Python, I have a birthday date and need to show that The person's zodiac signs are based on their birthday.
Has anyone done this before? What will be the most effective way to accomplish this?
I did this before, the simplest solution I had to finish was an array of the following keys / values. 120: Caps, 420: Erie, 521: Tau, 621: Gems, 722: Can, 823: Leo, 923: Veer, 1023: Lib 1122: SCOO, 1222: SAGA, 1231: CAP
Then you format MD , that is the number of months (beginning January 1) and two Digit day number (01-31). Changing through the array, and if the date is less than or equal to an object in the array, then you have your star sign.
Edit I need this, so this concept here is a functional task
zodiacs = [(120, 'cap'), (218, 'A'), (320, 'pins'), (420, 'eri'), (521, 'tau'), (621, 'ratna'), (722, 'can'), (823 , 'Leo'), (923, 'Veer'), (1023, 'Lib'), (1122, SOU), (1222, 'SAG'), (1231, 'Cap')] DF Mill_Jodiac_of_date (date): Date_number = int (join ("str (date.date (.month)), '% datedate () for z in% 02d Zodiacs.))): If date_number & lt; = Z [0]: return z [1]
Comments
Post a Comment