Quick actions

cmd+k|ctrl+k

Navigation

Languages

cs235-hw1-checkYear

Snippet info

Language

Python

Visibility

public

Author

o1xhack

Created

2016-10-03T21:48:23Z

Updated

2016-10-03T21:48:23Z


# cs235
# Yuxiao Wang
# hw1
# question 3

## for test list:
a = [2011,2344,2000,2008,2016,1995,987,3028,4762,2018,2400]

def checkYear(a):
    return all (1000<=x<3000 for x in a)

def remove(a):
    if checkYear(a) == False:
        return [x for x in a if 1000<=x<3000]

def leap(a):
    b = remove(a)
    return {x for x in b if (x%4==0 and x%100!=0) or (x%400==0)}
    
INFO