Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit d85e4a4

Browse files
authored
Merge pull request #393 from Hamed-68/master
change month_days to smallest func
2 parents 68070ec + 4883208 commit d85e4a4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: projects/Calculate_age/calculate.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ def judge_leap_year(year):
1212

1313
# returns the number of days in each month
1414
def month_days(month, leap_year):
15-
if month == 1 or month == 3 or month == 5 or month == 7:
15+
if month in [1, 3, 5, 7, 8, 10, 12]:
1616
return 31
17-
elif month == 8 or month == 10 or month == 12:
18-
return 31
19-
elif month == 4 or month == 6 or month == 9 or month == 11:
17+
elif month in [4, 6, 9, 11]:
2018
return 30
2119
elif month == 2 and leap_year:
2220
return 29

0 commit comments

Comments
 (0)