A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
2
Task/Leap-year/Python/leap-year-1.py
Normal file
2
Task/Leap-year/Python/leap-year-1.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import calendar
|
||||
calendar.isleap(year)
|
||||
4
Task/Leap-year/Python/leap-year-2.py
Normal file
4
Task/Leap-year/Python/leap-year-2.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def is_leap_year(year):
|
||||
if year % 100 == 0:
|
||||
return year % 400 == 0
|
||||
return year % 4 == 0
|
||||
8
Task/Leap-year/Python/leap-year-3.py
Normal file
8
Task/Leap-year/Python/leap-year-3.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import datetime
|
||||
|
||||
def is_leap_year(year):
|
||||
try:
|
||||
datetime.date(year, 2, 29)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
Loading…
Add table
Add a link
Reference in a new issue