Hello everyone.

I have a simple challenge for you today. In mathematics, the formula for finding the sum to infinity of a geometric sequence is: 



**ONLY IF** `-1 < r < 1`

where:

* `a` is the first term of the sequence
* `r` is the common ratio of the sequence (calculated by dividing one term in the sequence by the previous term)

For example: `1 + 0.5 + 0.25 + 0.125 + ... = 2`

Your challenge is to calculate the sum to infinity of the given sequence. The solution must be rounded to 3 decimal places.

If there are no solutions, for example if `r` is out of the above boundaries, return `"No Solutions"`.

Hope you enjoy, let me know of any issues or improvements!

Difficulty: EASY
Starter code: def sum_to_infinity(sequence):
	

Solutions:
def sum_to_infinity(sequence):
	return round(sequence[0] / (1 - sequence[1] / sequence[0]), 3) if abs(sequence[1] / sequence[0]) < 1 else 'No Solutions'


def sum_to_infinity(sequence):
	sequence = [float(x) for x in sequence]
	(a, r) = (sequence[0], sequence[1] / sequence[0])
	if -1 < r < 1:
		return round(a / (1 - r), 3)
	return 'No Solutions'


def sum_to_infinity(sequence):
	(x, y) = sequence[:2]
	return round(x * x / (x - y), 3) if abs(x) > abs(y) else 'No Solutions'


def sum_to_infinity(arr):
	(a, b) = arr[:2]
	c = b / a
	return round(a / (1 - c), 3) if -1 < c < 1 else 'No Solutions'


def sum_to_infinity(seq):
	if len(seq) < 2:
		return 'No Solutions'
	r = seq[1] / seq[0]
	if r >= 1 or r <= -1:
		return 'No Solutions'
	return 1 if seq[0] == seq[1] else round(seq[0] / (1 - r), 3)


def sum_to_infinity(A):
	r = A[1] / A[0]
	if abs(r) >= 1:
		return 'No Solutions'
	else:
		return round(A[0] / (1 - r), 3)


sum_to_infinity = lambda l: 'No Solutions' if abs(l[1]) >= abs(l[0]) else round(l[0] / (1 - l[1] / l[0]), 3)


def sum_to_infinity(sequence):
	a = sequence[0]
	r = sequence[1] / a
	return round(a / (1 - r), 3) if -1 < r < 1 else 'No Solutions'


def sum_to_infinity(seq):
	r = seq[1] / seq[0]
	return round(seq[0] / (1 - r), 3) if -1 < r < 1 else 'No Solutions'


def sum_to_infinity(sequence):
	r = sequence[2] / sequence[1]
	if not -1 < r < 1:
		return 'No Solutions'
	return round(sequence[0] / (1 - r), 3)


def sum_to_infinity(l):
	return round(l[0] / (1 - l[1] / l[0]), 3) if l[1] / l[0] < 1 and l[1] / l[0] > -1 else 'No Solutions'


def sum_to_infinity(sequence):
	r = sequence[1] / sequence[0]
	if r <= -1 or r >= 1:
		return 'No Solutions'
	sum = sequence[0] / (1 - r)
	return round(sum, 3)


def sum_to_infinity(sequence):
	if sequence[1] / sequence[0] < 1 and sequence[1] / sequence[0] > -1:
		return float(str(round(sequence[0] / (1 - sequence[1] / sequence[0]), 3)))
	return 'No Solutions'


def sum_to_infinity(seq):
	r = seq[1] / seq[0]
	if not abs(r) < 1:
		return 'No Solutions'
	res = seq[0] / (1 - r)
	return round(res, 3)