# Introduction

The first century spans from the **year 1** *up to* and **including the year 100**, **The second** - *from the year 101 up to and including the year 200*, etc.

# Task : 
Given a year, return the century it is in.

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def century(year):
	

Solutions:
def century(year):
	return (year + 99) // 100


import math

def century(year):
	return math.ceil(year / 100)


def century(year):
	return year / 100 if year % 100 == 0 else year // 100 + 1


def century(year):
	return (year - 1) // 100 + 1


from math import ceil

def century(year):
	(centuries, remaining) = divmod(year, 100)
	return centuries + bool(remaining)

def century(year):
	return ceil(year / 100)

def century(year):
	return year // 100 + bool(year % 100)

def century(year):
	return year // 100 + (not not year % 100)

def century(year):
	return -(-year // 100)

def century(year):
	return (year + 99) // 100


def century(year):
	year = year // 100 + bool(year % 100)
	return year


def century(year):
	return -(-year // 100)


century = lambda y: (y + 99) // 100


from math import ceil
century = lambda _: ceil(_ / 100)


def century(year):
	for i in range(year):
		if year in range(i * 100 + 1, (i + 1) * 100 + 1):
			return i + 1


century = lambda y: y // 100 + 1 if y % 100 else y // 100


def century(year):
	(value, remainder) = divmod(year, 100)
	return value + 1 if remainder else value


import math

def century(year):
	result = year / 100
	return math.ceil(result)
	print(result)


def century(year):
	(q, r) = divmod(year, 100)
	return q + bool(r)


century = lambda year: (year + 99) // 100


def century(year):
	year = str(year)
	if len(year) < 3:
		return 1
	elif len(year) == 3 and len(year) < 4:
		x = int(year[1] + year[2])
		if x >= 1 and x <= 99:
			return int(year[0]) + 1
		else:
			return int(year[0])
	elif len(year) == 4 and len(year) < 5:
		x = int(year[2] + year[3])
		if x >= 1 and x <= 99:
			return int(year[0] + year[1]) + 1
		else:
			return int(year[0] + year[1])
	elif len(year) == 5 and len(year) < 6:
		x = int(year[3] + year[4])
		if x >= 1 and x <= 99:
			return int(year[0] + year[1] + year[2]) + 1
		else:
			return int(year[0] + year[1] + year[2])
	elif len(year) == 6 and len(year) < 7:
		x = int(year[4] + year[5])
		if x >= 1 and x <= 99:
			return int(year[0] + year[1] + year[2] + year[3]) + 1
		else:
			return int(year[0] + year[1] + year[2] + year[3])
	elif len(year) == 7 and len(year) < 8:
		x = int(year[5] + year[6])
		if x >= 1 and x <= 99:
			return int(year[0] + year[1] + year[2] + year[3] + year[4]) + 1
		else:
			return int(year[0] + year[1] + year[2] + year[3] + year[4])
	elif len(year) == 8 and len(year) < 9:
		x = int(year[6] + year[7])
		if x >= 1 and x <= 99:
			return int(year[0] + year[1] + year[2] + year[3] + year[4] + year[5]) + 1
		else:
			return int(year[0] + year[1] + year[2] + year[3] + year[4] + year[5])


century = lambda y: 0 - y // -100


def century(year):
	return round(year / 100.0 + 0.495)


def century(year):
	remainder = year % 100
	year = int(year / 100)
	if remainder > 0:
		year += 1
	return year


def century(year):
	counter = 0
	while year >= 1:
		year = year - 100
		counter = counter + 1
	return counter


def century(year):
	s = str(year)
	if year <= 100:
		return 1
	elif year % 100 == 0:
		return int(s[:-2])
	else:
		return 1 + int(s[:-2])


def century(year):
	S = str(year)
	L = len(str(year))
	if L == 2:
		return L - 1
	elif L == 3:
		return int(S[0]) + 1
	else:
		return int(S[:-2]) if S[-2:] == '00' else int(S[:-2]) + 1


century = lambda year: -(-1 * year // 100)


def century(year):
	if year < 101:
		m = 1
	else:
		y = str(year)
		m = int(y[:-2])
		n = int(y[-2:])
		if n != 0:
			m += 1
	return m


def century(year):
	if year >= 100 and year % 100 == 0:
		return int(year / 100)
	elif year >= 100:
		return int(year / 100) + 1
	else:
		return 1


def century(year):
	if year > 99:
		if int(str(year)[2:]) > 0:
			return int(str(year)[:-2]) + 1
		else:
			return int(str(year)[:-2])
	elif year > 0:
		return 1
	else:
		return 0


def century(year):
	digits = list(str(year).zfill(6))
	century = int(''.join(digits[0:4]))
	years = ''.join(digits[4:7])
	if years == '00':
		return century
	else:
		return century + 1


def century(year):
	if year < 100:
		return 1
	if str(year)[-2:] == '00':
		return int(str(year)[:-2])
	return int(str(year)[:-2]) + 1


def century(year):
	if year % 100 == 0:
		return int(year / 100)
	else:
		return int(year / 100) + 1
ans = century(89)


def century(year):
	century = 0
	for interval in range(0, year, 100):
		century += 1
	return century


def century(year):
	return int(str(year + 99)[:-2])


def century(year):
	if (year / 100).is_integer():
		return year / 100
	else:
		return int(year / 100) + 1


def century(year):
	(a, b) = divmod(year, 100)
	return a + 2 * b // (b + 1)


def century(year):
	(a, b) = divmod(year, 100)
	return a + 1 - (not b)


def century(year):
	anul = int(year)
	secol = int(anul / 100 + 1)
	if anul % 100 == 0:
		secol_1 = secol - 1
		return secol_1
	else:
		return secol


def century(year):
	x = (year - 1) / 100
	y = x + 1
	y = int(y)
	return y


def century(year):
	div = year // 100
	rest = year % 100
	if rest == 0:
		return div
	else:
		return div + 1


def century(year):
	if year < 101:
		return 1
	if str(year)[-2:] == '00':
		return int(str(year)[:-2])
	return int(str(year)[:-2]) + 1


def century(year):
	century = year / 100
	if century.is_integer() == False:
		century = int(century) + 1
	return century


def century(year):
	sonuc = 0
	if year % 100 == 0:
		sonuc = year / 100
	else:
		sonuc = year / 100 + 1
	return int(sonuc)


def century(year):
	x = 0
	count = 0
	while year > x:
		x = x + 100
		count = count + 1
	return count


from math import *

def century(year):
	if str(year)[-2:] == '00':
		year = year - 1
	return floor(year / 100) + 1
date = 1900
print(century(date))


def century(y):
	p = y % 100
	if p == 0:
		x = y // 100
	else:
		x = y // 100
		x = x + 1
	return x


def century(year):
	yearOne = str(year)
	length = len(yearOne)
	lastTwo = int(yearOne[length - 2:length])
	if lastTwo > 0:
		century = int((year - lastTwo + 100) / 100)
	else:
		century = int((year - lastTwo) / 100)
	return century


import math

def century(year):
	return math.floor(year / 100) + (year % 100 and 1)


def century(year):
	if year < 100:
		return 1
	elif year < 1000:
		if year % 100 == 0:
			return year // 100
		else:
			return year // 100 + 1
	elif year % 10 == 0 and year // 10 % 10 == 0:
		return int(str(year)[:len(str(year)) - 2])
	else:
		return int(str(year)[:len(str(year)) - 2]) + 1


def century(year):
	year = year / 100
	if year.is_integer():
		return int(year)
	elif isinstance(year, float):
		years = year + 1
		return int(years)


def century(year):
	century = 1
	yearCount = 100
	if year < 101:
		return 1
	else:
		while yearCount < year:
			yearCount = yearCount + 100
			century = century + 1
	return century
	return


def century(year):
	year1 = year - 1 if str(year).endswith('00') else year
	return int(str(year1 + 100)[:-2])


def century(year):
	siglo = 0
	if year < 100:
		siglo = 1
	else:
		siglo = year // 100
		uno = year % 100
		if uno >= 1:
			siglo += 1
	return siglo


def century(year):
	centuryCount = 0
	while year > 0:
		year -= 100
		centuryCount = centuryCount + 1
	return centuryCount


def century(year):
	cent = year // 100
	ost = year % 100
	if ost >= 0.01:
		cent1 = cent + 1
	else:
		cent1 = cent
	return cent1


import math

def century(year):
	if year % 100 == 0:
		return year / 100
	else:
		return math.ceil(year / 100)
	return


from math import *

def century(year):
	x = 0
	if year % 100 == 0:
		x = floor(int((year + 1) / 100))
	else:
		x = floor(int(year / 100 + 1))
	return x
print(century(1249))


def century(year):
	return int(-(-year // 100))


import math

def century(year):
	if year % 100 == 0:
		what_century = year / 100
	else:
		what_century = math.floor(year / 100) + 1
	return what_century


def century(year):
	if year >= 10000:
		return int(year / 100) + 1 if year % 10 == 0 else int(year / 100) + 1
	else:
		return int(year / 100) if year % 10 == 0 else int(year / 100) + 1


def century(year):
	if year < 100:
		return 1
	elif year % 100 == 0:
		return year // 100
	else:
		x = year // 100
		return x + 1


import math

def century(year):
	if 100 >= year >= 1:
		return 1
	elif year % 2 == 0:
		return math.ceil(year / 100)
	else:
		return year // 100 + 1


def century(year):
	if len(str(year)) > 3:
		print(str(year)[len(str(year)) - 1])
		if str(year)[len(str(year)) - 1] == '0' and str(year)[len(str(year)) - 2] == '0':
			return int(str(year)[:len(str(year)) - 2])
		else:
			return int(str(year)[:len(str(year)) - 2]) + 1
	elif len(str(year)) == 3:
		return int(str(year)[0]) + 1
	else:
		return 1


def century(year):
	workshop = list(str(year))
	if len(workshop) > 2:
		if year % 100 == 0:
			return int(''.join(workshop[:-2]))
		else:
			return int(''.join(workshop[:-2])) + 1
	else:
		return 1


def century(year):
	result = 0
	if year % 100 == 0:
		cent = year // 100
	else:
		cent = year // 100 + 1
	return cent


def century(year):
	if year % 100 == 0:
		return year / 100
	else:
		return round((year + 50) / 100)


def century(year):
	return int(year / 100) + 1 if not year % 100 == 0 else int(year / 100)


def century(year):
	if year <= 0:
		return '0 and negative is not allow for a year'
	elif year <= 100:
		return 1
	elif year % 100 == 0:
		return year // 100
	else:
		return year // 100 + 1