A variation of determining leap years, assuming only integers are used and years can be negative and positive.

Write a function which will return the days in the year and the year entered in a string.  For example 2000, entered as an integer, will return as a string 2000 has 366 days

There are a few assumptions we will accept the year 0, even though there is no year 0 in the Gregorian Calendar.

Also the basic rule for validating a leap year are as follows

Most years that can be divided evenly by 4 are leap years. 

Exception: Century years are NOT leap years UNLESS they can be evenly divided by 400.

So the years 0, -64 and 2016 will return 366 days.
Whilst 1974, -10 and 666 will return 365 days.

Difficulty: EASY
Starter code: def year_days(year):
	

Solutions:
def year_days(year):
	days = 365
	if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
		days += 1
	return '%d has %d days' % (year, days)


from calendar import isleap

def year_days(year):
	return '{} has {} days'.format(year, isleap(year) + 365)


def year_days(year):
	return '{} has {} days'.format(year, 366 if year % 400 == 0 or (year % 4 == 0 and year % 100) else 365)


import calendar

def year_days(year):
	if calendar.isleap(year):
		return '{0} has 366 days'.format(year)
	else:
		return '{0} has 365 days'.format(year)


from calendar import isleap

def year_days(year):
	return f'{year} has {365 + isleap(year)} days'


year_days = lambda y: '{} has {} days'.format(y, 365 + (y % 4 == 0) * ((y % 100 != 0) + (y % 400 == 0)))


def year_days(year):
	x = 366 if year % 100 != 0 and year % 4 == 0 or year % 400 == 0 else 365
	return '%d has %d days' % (year, x)


def year_days(year):
	if year % 100 == 0:
		if year % 400 == 0:
			return '%s has 366 days' % year
		else:
			return '%s has 365 days' % year
	else:
		return '%s has 366 days' % year if year % 4 == 0 else '%s has 365 days' % year


def year_days(year):
	days = 365 if year % 4 else 366 if year % 100 else 365 if year % 400 else 366
	return '{0} has {1} days'.format(year, days)


from calendar import isleap

def year_days(year: int) -> str:
	return f'{year} has {(366 if isleap(year) else 365)} days'


def year_days(year: int) -> str:
	if not year % 4:
		if not year % 100:
			if not year % 400:
				days_per_year = 366
			else:
				days_per_year = 365
		else:
			days_per_year = 366
	else:
		days_per_year = 365
	return f'{year} has {days_per_year} days'


def year_days(year):
	return '%d has %d days' % (year, 365 + (not year % 400 if not year % 100 else not year % 4))


def year_days(y):
	return f'{y} has {[365, 366][y % 4 == 0 and (y % 400 == 0 or y % 100 != 0)]} days'


year_days = lambda y: '{} has {} days'.format(y, __import__('calendar').isleap(y) + 365)


year_days = lambda y: '%d has %d days' % (y, 365 + (y % 400 < 1 or (y % 100 and y % 4 < 1)))


year_days = lambda y: '%s has %s days' % (y, __import__('calendar').isleap(y) + 365)


def year_days(year):
	if year == 0:
		return '0 has 366 days'
	elif year % 100 == 0 and year % 400 == 0:
		return f'{year} has 366 days'
	elif year % 4 == 0 and year % 100 != 0:
		return f'{year} has 366 days'
	else:
		return f'{year} has 365 days'


def year_days(year):
	days = 365
	if year % 100 == 0:
		if year % 400 == 0:
			days += 1
	elif year % 4 == 0:
		days += 1
	return f'{year} has {days} days'


def year_days(year):
	is_leap_year = year % 4 == 0 and year % 100 != 0 or year % 400 == 0
	return f'{year} has {365 + int(is_leap_year)} days'


def find_leapyear(year):
	if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
		return 1
	else:
		return 0

def year_days(year):
	if find_leapyear(year):
		return f'{year} has 366 days'
	else:
		return f'{year} has 365 days'


def year_days(year):
	if abs(year) % 100 == 0:
		return f'{year} has 366 days' if abs(year) % 400 == 0 else f'{year} has 365 days'
	else:
		return f'{year} has 366 days' if abs(year) % 4 == 0 else f'{year} has 365 days'


def year_days(year):
	leap = False
	if year % 100 == 0:
		if year % 400 == 0:
			leap = True
	elif year % 4 == 0:
		leap = True
	return str(year) + ' has ' + str([365, 366][leap]) + ' days'


def year_days(y):
	days = 365
	if y % 4 == 0 and y % 100 != 0 or y % 400 == 0:
		days = days + 1
	return '{} has {} days'.format(y, days)


def year_days(y):
	d = '365' if y % 4 or (y % 100 == 0 and y % 400 != 0) else '366'
	return f'{y} has {d} days'


import datetime

def year_days(year):
	if year == 0:
		return f'{year} has 366 days'
	elif year % 400 == 0:
		return f'{year} has 366 days'
	elif year % 100 == 0:
		return f'{year} has 365 days'
	elif year % 4 == 0:
		return f'{year} has 366 days'
	else:
		return f'{year} has 365 days'


def year_days(y):
	leap = 0
	if y % 400 == 0:
		leap = 1
	elif y % 4 == 0 and y % 100 != 0:
		leap = 1
	return '{} has {} days'.format(y, 365 + leap)


def year_days(year):
	if not year % 400:
		return f'{year} has 366 days'
	if not year % 4 and year % 100:
		return f'{year} has 366 days'
	return f'{year} has 365 days'


def year_days(w):
	return f'{w} has 36{5 + (not w % 4 and (not (not w % 100 and w % 400)))} days'


def year_days(year):
	if year % 4 == 0:
		if year % 400 == 0 or year % 100 != 0:
			return str(year) + ' has 366 days'
		else:
			return str(year) + ' has 365 days'
	else:
		return str(year) + ' has 365 days'


def year_days(y):
	if y % 100 == 0:
		return f'{y} has 366 days' if y % 400 == 0 else f'{y} has 365 days'
	return f'{y} has 366 days' if y % 4 == 0 else f'{y} has 365 days'


def year_days(year):
	leap = False
	if year % 4 == 0:
		leap = True
		if year % 100 == 0:
			leap = False
			if year % 400 == 0:
				leap = True
	if leap:
		days = 366
	else:
		days = 365
	return f'{year} has {days} days'


def year_days(y):
	return f'{y} has {(366 if not y % 400 or (y % 100 and (not y % 4)) else 365)} days'


def year_days(y):
	return f'{y} has {365 + (1 if not y % 4 and (y % 100 or not y % 400) else 0)} days'


def year_days(y):
	return '{} has {} days'.format(y, [365, 366, 365, 366][(y % 4 == 0) + (y % 100 == 0) + (y % 400 == 0)])


def year_days(year):
	d = 365
	if year % 100 == 0:
		if year % 400 == 0:
			d = 366
	elif year % 4 == 0:
		d = 366
	return str(year) + ' has ' + str(d) + ' days'


def year_days(y):
	day = '365'
	if y % 100 == 0:
		if y % 400 == 0:
			day = '366'
	elif y % 4 == 0:
		day = '366'
	return f'{y} has {day} days'


def year_days(year):
	nb_days = 366 if year % 400 == 0 or (year % 4 == 0 and (not year % 100 == 0)) else 365
	return f'{year} has {nb_days} days'


def year_days(year):
	msg = ' has 365 days'
	if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
		msg = ' has 366 days'
	return str(year) + msg


def year_days(year):
	abs_year = abs(year)
	leap_year = ' has 365 days'
	if abs_year % 100 == 0 and abs_year % 400 == 0:
		leap_year = ' has 366 days'
	elif abs_year % 100 != 0 and abs_year % 4 == 0:
		leap_year = ' has 366 days'
	return str(year) + leap_year


def year_days(year):
	d = 0
	if int(year % 400) == 0:
		d = 366
	elif int(year % 4) == 0 and int(year % 100) != 0:
		d = 366
	else:
		d = 365
	return '{} has {} days'.format(year, d)


def year_days(year):
	mystr = str()
	if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
		days_in_year = 366
	else:
		days_in_year = 365
	mystr = str(year) + ' has ' + str(days_in_year) + ' days'
	return mystr


def year_days(year):
	is_leap = year % 4 == 0 and year % 100 != 0 or year % 400 == 0
	return f'{year} has {365 + is_leap} days'


def year_days(year):
	leap = 0 if year % 4 else 1
	cent = 0 if year % 100 else -1
	quad = 0 if year % 400 else 1
	return f'{year} has {365 + leap + cent + quad} days'


def year_days(year):
	return '{0} has {1} days'.format(year, 366 if is_leap(year) else 365)

def is_leap(year):
	if year % 4 == 0:
		if year % 100 == 0:
			if year % 400 == 0:
				return True
			else:
				return False
		else:
			return True
	else:
		return False


def leap(year):
	solu = True
	if year >= 1000:
		if year % 4 == 0:
			solu = True
			if year % 100 == 0:
				if year % 400 == 0:
					solu = True
				else:
					solu = False
		else:
			solu = False
	elif year >= 100:
		if year % 4 == 0:
			if year % 100 == 0:
				if year % 400 == 0:
					solu = True
				else:
					solu = False
		else:
			solu = False
	elif year % 4 == 0:
		solu = True
	else:
		solu = False
	return solu

def year_days(year):
	temp = year
	if temp == 0:
		return str(year) + ' has 366 days'
	elif temp < 0:
		temp *= -1
	if leap(temp):
		return str(year) + ' has 366 days'
	else:
		return str(year) + ' has 365 days'


def year_days(year):
	num_days = 365
	if year % 100 == 0:
		if year / 100 % 4 == 0:
			num_days = 366
	elif year % 4 == 0:
		num_days = 366
	return '{} has {} days'.format(year, num_days)


def year_days(year):
	if str(year)[-2:] == '00' and year % 400 != 0:
		return f'{year} has 365 days'
	if str(year)[-2:] == '00' and year % 400 == 0:
		return f'{year} has 366 days'
	if year % 4 == 0:
		return f'{year} has 366 days'
	return f'{year} has 365 days'


def year_days(year):
	day = year % 100 == 0 and year % 400 == 0 or (not year % 100 == 0 and year % 4 == 0)
	days = (5, 6)
	years = f'{year} has 36{days[day]} days'
	return years