Калоян обнови решението на 08.03.2015 22:01 (преди около 10 години)
▸ Покажи разликите+def interpret_western_sign(day, month):
+ if (month==3 and day>=21) or (month==4 and day<=20):
+ variable="aries"
+ elif (month==4 and day>=21) or (month==5 and day<=20):
+ variable="taurus"
+ elif (month==5 and day>=21) or (month==6 and day<=20):
+ variable="gemini"
+ elif (month==6 and day>=21) or (month==7 and day<=22):
+ variable="cancer"
+ elif (month==7 and day>=23) or (month==8 and day<=22):
+ variable="leo"
+ elif (month==8 and day>=23) or (month==9 and day<=22):
+ variable="virgo"
+ elif (month==9 and day>=23) or (month==10 and day<=22):
+ variable="libra"
+ elif (month==10 and day>=23) or (month==11 and day<=21):
+ variable="scorpio"
+ elif (month==11 and day>=22) or (month==12 and day<=21):
+ variable="sagittarius"
+ elif (month==12 and day>=22) or (month==1 and day<=20):
+ variable="capricorn"
+ # aquarius <=18 not <=19
+ elif (month==1 and day>=21) or (month==2 and day<=18):
+ variable="aquarius"
+ elif (month==2 and day>=19) or (month==3 and day<=20):
+ variable="pisces"
+
+ return(variable)
+
+
+
+def interpret_chinese_sign(year):
+ if year>=0:
+ variable1=year%12
+ else:
+ variable1=12-(-year)%12
+
+ # 1900->rat; 1900%12=4, 12-4=8 => 0 stands for "monkey"
+ if variable1==0:
+ variable2="monkey"
+ elif variable1==1:
+ variable2="rooster"
+ elif variable1==2:
+ variable2="dog"
+ elif variable1==3:
+ variable2="pig"
+ elif variable1==4:
+ variable2="rat"
+ elif variable1==5:
+ variable2="ox"
+ elif variable1==6:
+ variable2="tiger"
+ elif variable1==7:
+ variable2="rabbit"
+ elif variable1==8:
+ variable2="dragon"
+ elif variable1==9:
+ variable2="snake"
+ elif variable1==10:
+ variable2="horse"
+ elif variable1==11:
+ variable2="sheep"
+
+ return(variable2)
+
+
+def interpret_both_signs(day, month, year):
+ western=interpret_western_sign(day, month)
+ chinese=interpret_chinese_sign(year)
+ return (western, chinese)
+