# Summation

Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0.

For example:
```if-not:racket
~~~
summation(2) -> 3
1 + 2

summation(8) -> 36
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
~~~
```
```if:racket
~~~racket
(summation 2) ; 3  (+ 1 2)
(summation 8) ; 36 (+ 1 2 3 4 5 6 7 8)
~~~
```

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def summation(num):
	

Solutions:
def summation(num):
	return sum(range(num + 1))


def summation(num):
	return (1 + num) * num / 2


def summation(num):
	total = 0
	for i in range(0, num + 1):
		total = total + i
	return total


def summation(num):
	if num > 1:
		return num + summation(num - 1)
	return 1


summation = lambda n: n * -~n >> 1


def summation(num):
	fac = 0
	i = 0
	while i < num:
		i += 1
		fac = fac + i
	return fac


summation = lambda x: sum(range(1, x + 1))


def summation(num):
	somme = 0
	for i in range(num):
		somme += i + 1
	return somme
	pass


def summation(num):
	sum = 0
	for x in range(1, num + 1):
		sum = sum + x
	return sum


def summation(num):
	ans = 0
	for x in range(1, num):
		ans += x
	return ans + num


def summation(num):
	answer = 0
	for x in range(num):
		answer = answer + num
		num = num - 1
	return answer


def summation(num):
	L = []
	for i in range(0, num + 1):
		L.append(i)
	return sum(L)


def summation(num):
	return sum([n + 1 for n in range(num)])


def summation(num):
	result = 0
	for i in range(1, num + 1):
		result += i
	return result


def summation(num):
	for i in range(0, num):
		num += i
	return num


summation = lambda n: n * (n + 1) / 2


summation = lambda num: sum([i for i in range(num)], num)


def summation(n):
	f = 0
	for i in range(1, n + 1):
		f += i
	return f


summation = lambda s: sum(range(s + 1))


def summation(num):
	ret = 0
	for _ in range(0, num + 1):
		ret += _
	return ret


def summation(num):
	num_sum = 0
	for i in range(num + 1):
		num_sum += i
	return num_sum


def summation(num):
	a = 0
	for i in range(num):
		a = a + i + 1
	return a


def summation(num):
	a = 1
	i = 2
	while i <= num:
		a = i + a
		i += 1
	return a


def summation(num):
	tmp = 0
	for j in range(0, num + 1):
		tmp = j + tmp
	return tmp


def summation(num):
	sum = 0
	while num > 0:
		sum += num
		num -= 1
	return sum


def summation(num):
	pass
	suma = 0
	for i in range(0, num + 1):
		suma += i
	return suma


def summation(num):
	x = list(range(1, num + 1))
	sum = 0
	for i in x:
		sum += i
	return sum
	pass


def summation(num):
	if num < 1:
		print('El número debe ser mayor a 0')
	else:
		cont = 0
		total = 0
		while cont <= num:
			total = total + cont
			cont = cont + 1
		return total


def summation(num):
	return sum([i for i in range(num + 1)])


def summation(num):
	sumResult = 0
	while num > 0:
		sumResult = sumResult + num
		num -= 1
	return sumResult


def summation(num):
	sum = 0
	x = list(range(num + 1))
	for n in x:
		sum = sum + n
	return sum


def summation(num):
	to_return = 0
	n = 0
	while n != num:
		n += 1
		to_return += n
	return to_return


def summation(num):
	x = i = 0
	while i <= num:
		x = x + i
		i = i + 1
	return x


def summation(num):
	nombre = num
	sum_interm = 0
	while nombre > 0:
		sum_interm = sum_interm + nombre
		nombre -= 1
	return sum_interm


def summation(num):
	if num == 1:
		return 1
	else:
		return num + summation(num - 1)
print(summation(6))


def summation(num):
	newNum = 0
	for x in range(num + 1):
		newNum += x
	return newNum


def summation(num):
	a = 1
	num = num + 1
	for x in range(1, num):
		if x < num:
			a = a + x
	return a - 1


def summation(num):
	total = 1
	while num != 1:
		total = total + num
		num -= 1
	return total


def summation(num):
	n = list(range(num + 1))
	tot = sum(n)
	return tot


def summation(num):
	accum = 0
	for n in range(1, num + 1):
		accum += n
	return accum


def summation(n):
	return sum(list(range(1, n + 1)))


def summation(num):
	pass
	startvalue = 0
	for i in range(0, num + 1):
		startvalue += i
	outvalue = startvalue
	return outvalue


def summation(num):
	return sum(list(range(0, num + 1)))


def summation(num):
	x = 0
	for i in range(0, num):
		x = x + num
		num = num - 1
	return x


def summation(num):
	count = 0
	x = list(range(num))
	for n in x:
		if num > 0:
			count = count + num
			num = num - 1
	return count


def summation(num):
	endnumber = 0
	i = 0
	while num > i:
		i += 1
		endnumber += i
	return endnumber


def summation(num):
	total = 0
	for n in range(0, num + 1, 1):
		total += n
	return total


def summation(num):
	result = 0
	for k in range(1, num + 1):
		result += k
	return result


def summation(num):
	counter = 0
	for n in range(1, num + 1):
		counter += n
	return counter


def summation(num):
	pass
	i = 0
	rslt = 0
	while i <= num:
		rslt = rslt + i
		i = i + 1
	return rslt


def summation(num):
	sum = 0
	count = 0
	for loop in range(num):
		sum += num - count
		count += 1
	return sum


def summation(num):
	result = 0
	for number in range(num + 1):
		result += number
	return result


def summation(num):
	x = num
	if num > 0:
		while x > 0:
			num += x - 1
			x -= 1
		return num
	else:
		return print('error')
summation(0)


def summation(num):
	summa = 0
	for i in range(1, num + 1):
		summa += i
	return summa
summation(1)
summation(8)
summation(22)
summation(100)
summation(213)


def summation(num):
	sum = 1
	i = 2
	while i < num + 1:
		sum += i
		i += 1
	return sum


def summation(num):
	done = sum([x for x in range(1, num + 1)])
	return done


def summation(num):
	tot = 0
	for n in range(0, num + 1):
		tot += n
	return tot


def summation(num, sums=0):
	if num == 0:
		return sums
	else:
		return summation(num - 1, sums + num)


def summation(num):
	nr_list = list(range(1, num + 1))
	return sum(nr_list)


def summation(num):
	return sum(range(num + 1))
print(summation(5))


def summation(num):
	result = 0
	count = 1
	while count <= num:
		result += count
		count += 1
	return result

def __starting_point():
	assert summation(4)
__starting_point()


def summation(num):
	return sum(range(1, num + 1))
print(summation(6))


def summation(num):
	cnt = 0
	for x in range(num + 1):
		cnt += x
	return cnt
print(summation(8))


def summation(num):
	return num if num == 1 else sum([i for i in range(num + 1)])


def summation(num):
	lone = 0
	for i in range(1, num + 1):
		lone = lone + i
	return lone


def summation(num):
	if isinstance(num, int) and num > 0:
		s = 0
		for i in range(num):
			s = s + i
		return s + num
	else:
		print('No es un número entero positivo')


def summation(num):
	kata_range = []
	for i in range(1, num + 1):
		kata_range.append(i)
	return sum(kata_range)


def summation(num):
	a = []
	for i in range(num + 1):
		a.append(i)
	return sum(a)


def summation(num):
	y = 1
	solution = 0
	while y <= num:
		solution += y
		y += 1
	return solution


def summation(num):
	x = 0
	final = 0
	while x <= num:
		final += x
		x += 1
	return final


def summation(num):
	return num * (num * 0.5 + 0.5)


def summation(num: int) -> int:
	i = 0
	resultado = i
	while i <= num:
		resultado += i
		i += 1
	return resultado


def summation(num):
	number = list(range(1, num + 1))
	return sum(number)


def summation(num):
	b = 0
	c = 0
	for i in range(num):
		c += 1
		b += c
	return b