Aleksey Frolov avatar Aleksey Frolov committed 70d845e

initial commit

Comments (0)

Files changed (1)

+#!/usr/bin/env python
+
+import sys
+from datetime import date, timedelta
+import calendar
+
+today = date.today()
+birth = date(int(sys.argv[3]), int(sys.argv[2]), int(sys.argv[1]))
+
+## Возраст
+delta = today - birth
+leapdays = calendar.leapdays(birth.year, today.year)
+
+weekday = calendar.weekday(birth.year, birth.month, birth.day)
+
+age_full_days = delta.days
+age_full_days = (delta.days - leapdays) % 365
+age_years = (delta.days - leapdays) // 365
+age_months = int(age_full_days // (365 / 12))
+age_weeks = int(age_full_days % (365 / 12) / 7)
+age_days = int(age_full_days % (365 / 12) % 7)
+
+## До дня рождения
+new_birth = date(today.year, birth.month, birth.day) - today
+
+new_leapdays = 0
+if new_birth.days < 0:
+	new_birth += timedelta(days = 365)
+	new_leapdays = calendar.leapdays(today.year, today.year + 1)
+
+new_age_months = int(new_birth.days // (365 / 12))
+new_age_weeks = int(new_birth.days % (365 / 12) / 7)
+new_age_days = int(new_birth.days % (365 / 12 ) % 7 + new_leapdays)
+	
+## Знаки зодиака
+zodiac = (
+			('овен',		(3, 21),	(4, 20),	'огонь'),
+			('телец',		(4, 21), 	(5, 20), 	'земля'),
+			('близнецы',	(5, 21), 	(6, 20), 	'воздух'),
+			('рак',			(6, 21), 	(7, 22), 	'вода'),
+			('лев',			(7, 23), 	(8, 23), 	'огонь'),
+			('дева',		(8, 24), 	(9, 23), 	'земля'),
+			('весы', 		(9, 24), 	(10, 23),	'воздух'),
+			('скорпион',	(10, 24),	(11, 22), 	'вода'),
+			('стрелец', 	(11, 23),	(12, 21),	'огонь'),
+			('козерог', 	(12, 22),	(1, 20), 	'земля'),
+			('водолей', 	(1, 21), 	(2, 19), 	'воздух'),
+			('рыбы', 		(2, 20), 	(3, 20), 	'вода')
+		)
+		
+print('Возраст:')
+print(age_years, 'лет,', age_months, 'месяцев,', age_weeks, 'недель,', age_days, 'дней', end='\n\n')
+print('До дня рождения осталось:')
+print(new_age_months, 'месяцев,', new_age_weeks, 'недель,', new_age_days, 'дней', end='\n\n')
+
+for id, val in enumerate(zodiac):
+	if date(1, val[1][0], val[1][1]) < date(1, birth.month, birth.day) < date(1, val[2][0], val[2][1]):
+		print('Знак зодиака:', val[0] + ',', 'стихия:', val[3])
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.