Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit d85e4a4

Browse files
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

‎projects/Calculate_age/calculate.py

Lines changed: 2 additions & 4 deletions
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 ==1ormonth==3ormonth==5ormonth==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)

AltStyle によって変換されたページ (->オリジナル) /