A Narcissistic Number is a number of length n in which the sum of its digits to the power of n is equal to the original number. If this seems confusing, refer to the example below.

Ex: 153, where n = 3 (number of digits in 153)
1^(3) + 5^(3) + 3^(3) = 153

Write a method is_narcissistic(i) (in Haskell: isNarcissistic :: Integer -> Bool) which returns whether or not i is a Narcissistic Number.

Difficulty: EASY
Starter code: def is_narcissistic(i):
	

Solutions:
def is_narcissistic(n):
	num = str(n)
	length = len(num)
	return sum((int(a) ** length for a in num)) == n


def is_narcissistic(i):
	return sum([int(n) ** len(str(i)) for n in str(i)]) == i


def is_narcissistic(n):
	t = str(n)
	l = len(t)
	return n == sum((int(d) ** l for d in t))


is_narcissistic = lambda n: sum((int(i) ** len(str(n)) for i in str(n))) == n


def is_narcissistic(i):
	return sum((int(d) ** len(str(i)) for d in str(i))) == i


def is_narcissistic(i):
	numbers = list(str(i))
	power = len(str(i))
	sum = 0
	for number in numbers:
		sum += int(number) ** power
	return sum == i


def is_narcissistic(i):
	n = len(str(i))
	lst = list(str(i))
	answer = 0
	for value in lst:
		answer += int(value) ** n
	return answer == i


def is_narcissistic(i):
	digits = str(i)
	n = len(digits)
	return sum((int(d) ** n for d in digits)) == i


def is_narcissistic(i):
	s = str(i)
	return sum((int(x) ** len(s) for x in s)) == i


def is_narcissistic(i):
	sum_of_digits = 0
	exponent = len(str(i))
	for digit in str(i):
		sum_of_digits += int(digit) ** exponent
	return sum_of_digits == i