File tree Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change 16
16
The second line contains space-separated integers describing the colors of the socks in the pile.
17
17
18
18
Constraints
19
-
20
- where
21
19
Output Format
22
20
23
21
Return the total number of matching pairs of socks that Alex can sell.
35
33
36
34
Alex can match three pairs of socks'''
37
35
38
-
39
-
40
- #!/bin/python3
41
-
42
- import math
43
- import os
44
- import random
45
- import re
46
- import sys
47
-
48
- # Complete the sockMerchant function below.
36
+ #solution
49
37
def sockMerchant (n , ar ):
50
38
return sum ([ar .count (i )// 2 for i in set (ar )])
51
39
Original file line number Diff line number Diff line change 36
36
1990 is not a multiple of 4 hence it's not a leap year.'''
37
37
38
38
def is_leap (year ):
39
- return year % 4 == 0 and (year % 400 == 0 or year % 100 != 0 )
40
-
41
- # Write your logic here
42
-
43
- return leap
44
-
45
- year = int (raw_input ())
46
- print is_leap (year )
39
+ leapyear = False
40
+ if (((year % 4 == 0 and year % 100 != 0 ) or year % 400 == 0 ) and year >= 1900 ):
41
+ leapyear = True
42
+ return leapyear
43
+
44
+ year = int (input ())
45
+ print (is_leap (year ))
You can’t perform that action at this time.
0 commit comments