# Definition

**_Balanced number_** is the number that * **_The sum of_** all digits to the **_left of the middle_** digit(s) and the sum of all digits to the **_right of the middle_** digit(s) are **_equal_***.

____

# Task

**_Given_** a number, **_Find if it is Balanced or not_** . 
____

# Warm-up (Highly recommended)

# [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers)
___

# Notes 

* *If* the **_number has an odd number of digits_**  then **_there is only one middle digit_**,  e.g.  `92645`  has middle digit `6`;  **_otherwise_**, there are **_two middle digits_** , e.g.  `1301`  has middle digits  `3`  and  `0` 

* **_The middle digit(s)_**  should  **_not_** be considered when *determining whether a number is balanced or not*, **_e.g_**  `413023`  is a **_balanced number because the left sum and right sum are both_**   `5`.

* **_Number_** *passed is always*  **_Positive_** .

* **_Return_** *the result as* **_String_**

___

# Input >> Output Examples

```
(balanced-num 7) ==> return "Balanced"
```

## **_Explanation_**:

* **_Since_** , **_The sum of_** *all digits to the* **_left of the middle_** digit (0) 

* and **_the sum of_** *all digits to the* **_right of the middle_** digit (0) are **_equal_**  , **_then_** *It's* **_Balanced_**
___

```
(balanced-num 295591) ==> return "Not Balanced"
```

## **_Explanation_**:

* **_Since_** , **_The sum of_** *all digits to the* **_left of the middle_** digits (11) 

* and **_the sum of_** *all digits to the* **_right of the middle_** digits (10) are **_Not equal_**  , **_then_** *It's* **_Not Balanced_** 

* **_Note_** : **_The middle digit(s)_**  *are* **_55_** . 

___
```
(balanced-num 959) ==> return "Balanced"
```

## **_Explanation_**:

* **_Since_** , **_The sum of_** *all digits to the* **_left of the middle_** digits (9) 

* and **_the sum of_** *all digits to the* **_right of the middle_** digits (9) are **_equal_**  , **_then_** *It's* **_Balanced_** 

* **_Note_** : **_The middle digit_**  *is* **_5_** . 
____

```
(balanced-num 27102983) ==> return "Not Balanced"
```

## **_Explanation_**:

* **_Since_** , **_The sum of_** *all digits to the* **_left of the middle_** digits (10) 

* and **_the sum of_** *all digits to the* **_right of the middle_** digits (20) are **_Not equal_**  , **_then_** *It's* **_Not Balanced_** 

* **_Note_** : **_The middle digit(s)_**  *are* **_02_** . 

___
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def balanced_num(number):
	

Solutions:
def balancedNum(n):
	s = str(n)
	l = (len(s) - 1) // 2
	same = len(s) < 3 or sum(map(int, s[:l])) == sum(map(int, s[-l:]))
	return 'Balanced' if same else 'Not Balanced'
balanced_num = balancedNum


def balanced_num(number):
	number = [int(n) for n in str(number)]
	(left, right) = (0, 0)
	while len(number) > 2:
		left += number.pop(0)
		right += number.pop(-1)
	return 'Balanced' if left == right else 'Not Balanced'


def balanced_num(number):
	stg = str(number)
	half = (len(stg) - 1) // 2
	diff = sum((int(stg[i]) - int(stg[-1 - i]) for i in range(half)))
	return 'Not Balanced' if diff else 'Balanced'


def balanced_num(n):
	return '%sBalanced' % ('Not ' if sum((int(e) for e in str(n)[:(len(str(n)) + 1) // 2 - 1])) != sum((int(e) for e in str(n)[len(str(n)) // 2 + 1:])) else '')


def addsides(num):
	output = 0
	print(num)
	if num == '':
		return True
	num = int(num)
	while num != 0:
		output += num % 10
		num = num // 10
	return output

def balanced_num(number):
	number = str(number)
	if len(number) % 2 != 0:
		print(number)
		middle = None
		num1 = number[0:len(number) // 2]
		num2 = number[len(number) // 2 + 1:len(number)]
		print(num1, num2)
		if num1 == None or num2 == None:
			return 'Balanced'
		if addsides(num1) == addsides(num2):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		num1 = number[0:len(number) // 2 - 1]
		num2 = number[len(number) // 2 + 1:len(number)]
		if num1 == None or num2 == None:
			return 'Balanced'
		if addsides(num1) == addsides(num2):
			return 'Balanced'
		else:
			return 'Not Balanced'
		print(num1, num2)


def balanced_num(n):
	if n < 100:
		return 'Balanced'
	n = [int(i) for i in str(n)]
	return 'Balanced' if sum(n[:int(len(n) / 2) - 1 + len(n) % 2]) == sum(n[int(len(n) / 2) + 1:]) else 'Not Balanced'


def balanced_num(number):
	st_num = str(number)
	if number < 100:
		return 'Balanced'
	half_len = len(st_num) // 2 if len(st_num) % 2 != 0 else (len(st_num) - 1) // 2
	(right_sum, left_sum) = (0, 0)
	for i in range(half_len):
		left_sum += int(st_num[i])
		right_sum += int(st_num[-1 - i])
	return 'Balanced' if left_sum == right_sum else 'Not Balanced'


balanced_num = lambda n: 'Balanced' if sum([int(x) for x in str(n)[:int(len(str(n)) / 2 - 0.5)]]) == sum([int(x) for x in str(n)[int(len(str(n)) / 2 + 1):]]) else 'Not Balanced'


def balanced_num(number):
	d = list(map(int, str(number)))
	part = (len(d) - 1) // 2
	return 'Not ' * (sum(d[:part]) != sum(d[-part:]) and len(d) > 2) + 'Balanced'


def balanced_num(number):
	s = str(number)
	part = (len(s) - 1) // 2
	s1 = sum(map(int, s[:part]))
	s2 = sum(map(int, s[-part:]))
	return 'Not ' * (s1 != s2 and len(s) > 2) + 'Balanced'


def balanced_num(number: int) -> str:
	d = list(map(int, str(number)))
	return 'Balanced' if sum(d[:(len(d) - 1) // 2]) == sum(d[len(d) // 2 + 1:]) else 'Not Balanced'


import math

def balanced_num(number):
	s = []
	while number > 0:
		d = number % 10
		s.append(d)
		number = math.floor(number / 10)
	l = len(s)
	m = (l - 1) / 2
	left = math.floor(m)
	right = math.ceil(m)
	leftSum = 0
	rightSum = 0
	for i in range(l):
		n = s[i]
		if i < left:
			leftSum += n
		elif i > right:
			rightSum += n
	if rightSum == leftSum:
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	a = str(number)
	b = a[:len(a) // 2]
	c = a[len(a) // 2 + 1:]
	d = a[:len(a) // 2 - 1]
	if len(a) % 2 == 1:
		if sum([int(i) for i in b]) == sum([int(x) for x in c]):
			return 'Balanced'
		return 'Not Balanced'
	if len(a) % 2 == 0:
		if sum([int(i) for i in d]) == sum([int(x) for x in c]):
			return 'Balanced'
		return 'Not Balanced'


def balanced_num(number):
	b = list(str(number))
	if len(str(number)) % 2 != 0:
		i = len(str(number)) // 2
		bsum = 0
		asum = 0
		for n in b[0:i]:
			bsum += int(n)
		for n in b[-1:i:-1]:
			asum += int(n)
		if bsum == asum:
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		i = len(str(number)) // 2
		bsum = 0
		asum = 0
		for n in b[0:i - 1]:
			bsum += int(n)
		for n in b[-1:i:-1]:
			asum += int(n)
		if bsum == asum:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	l = len(str(number))
	List = list(str(number))
	if l == 1 or l == 2:
		return 'Balanced'
	else:
		sum1 = sum2 = 0
		if l % 2 == 0:
			for i in range(0, l // 2 - 1):
				j = -i - 1
				sum1 += int(List[i])
				sum2 += int(List[j])
		else:
			for i in range(0, l // 2):
				j = -i - 1
				sum1 += int(List[i])
				sum2 += int(List[j])
	return 'Balanced' if sum1 == sum2 else 'Not Balanced'


def balanced_num(number):
	if len(str(number)) == 1:
		return 'Balanced'
	nlen = len(str(number))
	number = str(number)
	mid = nlen // 2
	left = right = 0
	for i in range(nlen - 1, mid, -1):
		right += int(number[i])
	if nlen % 2 == 0:
		mid = mid - 1
	for i in range(0, mid):
		left += int(number[i])
	if left == right:
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	number = str(number)
	len_num = len(number)
	balanced = sum(map(int, number[:len_num // 2 - (len_num % 2 == 0)])) == sum(map(int, number[len_num // 2 + 1:]))
	return 'Balanced' if balanced else 'Not Balanced'


def balanced_num(num):
	str_num = str(num)
	len_num = len(str_num)
	if len_num % 2 != 0:
		nums = (str_num[0:int(len_num / 2)], str_num[int(len_num / 2 + 1):len_num])
		print((nums, sum(list(map(int, nums[0]))), sum(list(map(int, nums[1])))))
		return 'Balanced' if sum(list(map(int, nums[0]))) == sum(list(map(int, nums[1]))) else 'Not Balanced'
	else:
		nums = (str_num[0:int(len_num / 2 - 1)], str_num[int(len_num / 2 + 1):len_num])
		print((nums, sum(list(map(int, nums[0]))), sum(list(map(int, nums[1])))))
		return 'Balanced' if sum(list(map(int, nums[0]))) == sum(list(map(int, nums[1]))) else 'Not Balanced'


def balanced_num(number):
	string_n = str(number)
	l = len(string_n)
	middle = int(l / 2)
	(sum_left, sum_right) = (0, 0)
	if l % 2 == 0:
		for n in string_n[:middle - 1]:
			sum_left += int(n)
		for n in string_n[middle + 1:]:
			sum_right += int(n)
	else:
		for n in string_n[:middle]:
			sum_left += int(n)
		for n in string_n[middle + 1:]:
			sum_right += int(n)
	return 'Balanced' if sum_left == sum_right else 'Not Balanced'


def balanced_num(number):
	n = list(map(int, str(number)))
	l = (len(n) - 1, len(n) - 2)[len(n) % 2 == 0] // 2
	return 'Balanced' if number <= 99 else ('Not Balanced', 'Balanced')[sum(n[:l]) == sum(n[-l:])]


def balanced_num(number):
	n = (len(str(number)) - 1) // 2
	return 'Balanced' if n <= 0 or sum((int(i) for i in str(number)[:n])) == sum((int(j) for j in str(number)[-n:])) else 'Not Balanced'


def balanced_num(num):
	digits = [int(digit) for digit in str(num)]
	half = (len(digits) - 1) // 2
	(left_sum, right_sum) = (sum(digits[:half]), sum(digits[-half:]))
	return ('' if num < 100 or left_sum == right_sum else 'Not ') + 'Balanced'


balanced_num = lambda n: 'Not Balanced' if (lambda r: sum((int(d) for d in r[:(len(r) - 1) // 2])) - sum((int(d) for d in r[len(r) // 2 + 1:])))(str(n)) else 'Balanced'


def balanced_num(number):
	digits = [int(digit) for digit in str(number)]
	n = len(digits)
	middle = [n // 2, n // 2 + 1] if n % 2 == 1 else [n // 2 - 1, n // 2 + 1]
	left = digits[:middle[0]]
	right = digits[middle[1]:]
	return 'Balanced' if sum(left) == sum(right) else 'Not Balanced'


def balanced_num(number):
	number = str(number)
	l1 = len(number)
	l2 = int((l1 - 0.5) // 2)
	return ('Not Balanced', 'Balanced')[l1 < 3 or sum(map(int, number[:l2])) == sum(map(int, number[-l2:]))]


def balanced_num(number):
	l = []
	brk = len(str(number)) // 2
	if len(str(number)) == 2 or len(str(number)) == 1:
		return 'Balanced'
	for i in str(number):
		l.append(int(i))
	if len(l) % 2 == 0:
		left = l[:brk - 1]
		right = l[brk + 1:]
		if sum(left) == sum(right):
			return 'Balanced'
		else:
			return 'Not Balanced'
	if len(l) % 2 != 0:
		left = l[:brk]
		right = l[brk + 1:]
		if sum(left) == sum(right):
			return 'Balanced'
		else:
			return 'Not Balanced'
	pass


def balanced_num(n):
	if len(str(n)) % 2:
		t = len(str(n)) // 2
	else:
		t = (len(str(n)) - 1) // 2
	return ['Not Balanced', 'Balanced'][sum([int(x) for x in str(n)[:t]]) == sum([int(c) for c in str(n)[-t:]]) or t < 1]


def balanced_num(number):
	string_number = str(number)
	if len(string_number) <= 2:
		return 'Balanced'
	list_number = [int(i) for i in list(str(string_number))]
	if len(string_number) == 3:
		if list_number[0] == list_number[-1]:
			return 'Balanced'
		else:
			return 'Not Balanced'
	if len(list_number) % 2 == 0:
		middle_number = int(len(list_number) // 2)
		if sum(list_number[:middle_number - 1]) == sum(list_number[middle_number + 1:]):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		middle_number = int(len(list_number) // 2 + 1)
		if sum(list_number[:middle_number - 1]) == sum(list_number[middle_number:]):
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	num_string = str(number)
	length = len(num_string)
	if length < 3:
		return 'Balanced'
	split_at = length / 2 - 1 if length % 2 == 0 else length // 2
	sum_one = 0
	for num in num_string[:int(split_at)]:
		sum_one += int(num)
	sum_two = 0
	for num in num_string[-int(split_at):]:
		sum_two += int(num)
	return 'Balanced' if sum_one == sum_two else 'Not Balanced'


def balanced_num(number):
	num_length = len(str(number))
	if num_length <= 2:
		return 'Balanced'
	center = num_length // 2
	num_str = str(number)
	left = 0
	if num_length % 2 == 1:
		left = sum(map(int, num_str[:center]))
	else:
		left = sum(map(int, num_str[:center - 1]))
	right = sum(map(int, num_str[center + 1:]))
	if left == right:
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	s = list(map(int, str(number)))
	return ['Not Balanced', 'Balanced'][sum(s[:(len(s) - 1) // 2]) == sum(s[(len(s) - 1) // 2 + 1 + (len(s) % 2 == 0):])]


def balanced_num(number):
	num_len = len(str(number))
	left_tot = 0
	right_tot = 0
	if num_len <= 2:
		return 'Balanced'
	else:
		if num_len % 2 == 1:
			width = num_len // 2
		else:
			width = num_len // 2 - 1
		left = str(number)[:width]
		for (pos_l, left_sum) in enumerate(left):
			left_tot += int(left_sum)
		right = str(number)[-1 * width:]
		for (pos_r, right_sum) in enumerate(right):
			right_tot += int(right_sum)
	if left_tot == right_tot:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	middle = int(len(str(number)) / 2)
	left = []
	right = []
	l = []
	r = []
	if len(str(number)) == 1 or len(str(number)) == 2:
		return 'Balanced'
	elif len(str(number)) % 2 == 0:
		number = str(number)
		left = number[:middle - 1]
		right = number[middle + 1:]
		for num in left:
			l.append(int(num))
		for num in right:
			r.append(int(num))
		if sum(l) == sum(r):
			return 'Balanced'
		return 'Not Balanced'
	else:
		number = str(number)
		left = number[:middle]
		right = number[middle + 1:]
		for num in left:
			l.append(int(num))
		for num in right:
			r.append(int(num))
		if sum(l) == sum(r):
			return 'Balanced'
		return 'Not Balanced'


def sum(nums):
	ans = 0
	for num in nums:
		ans += int(num)
	return ans

def balanced_num(number):
	number = str(number)
	even = False
	middle = len(number) // 2
	if len(number) % 2 == 1:
		even = False
	else:
		even = True
	if not even:
		if sum(number[:middle]) == sum(number[middle + 1:]):
			return 'Balanced'
		else:
			return 'Not Balanced'
	elif even:
		if sum(number[:middle - 1]) == sum(number[middle + 1:]):
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	return 'Balanced' if sum((int(n) for n in str(number)[:len(str(number)) // 2 + 1])) == sum((int(n) for n in str(number)[::-1][:len(str(number)) // 2 + 1])) else 'Not Balanced'


def balanced_num(number):
	if number < 100:
		return 'Balanced'
	if len(str(number)) % 2:
		x = str(number)[:len(str(number)) // 2]
		y = str(number)[len(str(number)) // 2 + 1:]
		return 'Balanced' if sum([int(i) for i in x]) == sum([int(i) for i in y]) else 'Not Balanced'
	elif not len(str(number)) % 2:
		x = str(number)[:len(str(number)) // 2 - 1]
		y = str(number)[len(str(number)) // 2 + 1:]
		return 'Balanced' if sum([int(i) for i in x]) == sum([int(i) for i in y]) else 'Not Balanced'


def balanced_num(n):
	s = [int(i) for i in list(str(n))]
	l = s[:len(s) // 2]
	r = s[-1:len(s) // 2:-1]
	if len(s) == len(l) * 2:
		l = l[:-1]
		s = s[:-1]
	if sum(l) == sum(r):
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(n):
	(n, sr, sl) = (str(n), 0, 0)
	while len(n) > 2:
		sl += int(n[0])
		sr += int(n[-1])
		n = n[1:-1]
	return 'Balanced' if sr == sl else 'Not Balanced'


def balanced_num(number):
	array = list(map(int, str(number)))
	if len(array) % 2 == 0:
		left_side = array[0:int(len(array) / 2 - 1)]
		right_side = array[int(len(array) / 2) + 1:len(array)]
	else:
		left_side = array[0:int(len(array) / 2)]
		right_side = array[int(len(array) / 2) + 1:len(array)]
	left_sum = 0
	right_sum = 0
	for i in left_side:
		left_sum += i
	for j in right_side:
		right_sum += j
	if left_sum != right_sum:
		return 'Not Balanced'
	else:
		return 'Balanced'


def balanced_num(number):
	s = str(number)
	if len(s) % 2 == 0:
		(a, b) = (s[:len(s) // 2 - 1], s[len(s) // 2 + 1:])
	else:
		(a, b) = (s[:len(s) // 2], s[len(s) // 2 + 1:])
	return 'Balanced' if sum((int(d) for d in a)) == sum((int(d) for d in b)) else 'Not Balanced'


from math import ceil

def balanced_num(number):
	if number < 100:
		return 'Balanced'
	digits = [int(ch) for ch in str(number)]
	middle = ceil(len(digits) / 2) - 1
	return 'Balanced' if sum(digits[:middle]) == sum(digits[-middle:]) else 'Not Balanced'


def balanced_num(number):
	st = str(number)
	if len(st) == 1 or len(st) == 2:
		return 'Balanced'
	elif len(st) > 2:
		if len(st) % 2 == 0:
			l = st[:int(len(st) / 2) - 1]
			r = st[int(len(st) / 2) + 1:]
		else:
			l = st[:int(len(st) / 2)]
			r = st[int(len(st) / 2) + 1:]
	topl = lambda t: sum((int(i) for i in t))
	return 'Balanced' if topl(l) == topl(r) else 'Not Balanced'


def balanced_num(number):
	number = str(number)
	if len(number) % 2 != 0:
		middle = len(number) // 2
		leftside = number[:middle]
		rightside = number[middle + 1:]
		sumofleft = sum(list([int(x) for x in leftside]))
		sumofright = sum(list((int(x) for x in rightside)))
		if sumofleft == sumofright:
			return 'Balanced'
		else:
			return 'Not Balanced'
	if len(number) % 2 == 0:
		middle = len(number) // 2
		leftside = number[:middle - 1]
		rightside = number[middle + 1:]
		sumofleft = sum(list([int(x) for x in leftside]))
		sumofright = sum(list((int(x) for x in rightside)))
		if sumofleft == sumofright:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	a = str(number)
	a = list(a)
	a = [int(x) for x in a]
	print(a)
	if len(a) < 3:
		return 'Balanced'
	if len(a) == 3 and a[0] == a[-1]:
		return 'Balanced'
	if len(a) == 3 and a[0] != a[-1]:
		return 'Not Balanced'
	if len(a) > 3:
		if len(a) % 2 == 0:
			ln = int(len(a) / 2)
			print((a[0:ln - 1], a[ln + 1:]))
			if sum(a[0:ln - 1]) == sum(a[ln + 1:]):
				return 'Balanced'
			else:
				return 'Not Balanced'
		if len(a) % 2 != 0:
			ln = int(len(a) / 2)
			print((a[0:ln], a[ln + 1:]))
			if sum(a[0:ln]) == sum(a[ln + 1:]):
				return 'Balanced'
			else:
				return 'Not Balanced'


def balanced_num(number):
	number = str(number)
	if len(number) >= 3:
		return 'Balanced' if sum([int(x) for x in number[0:round(len(number) / 2 + 0.49) - 1]]) == sum([int(x) for x in number[-round(len(number) / 2 + 0.49) + 1:]]) else 'Not Balanced'
	else:
		return 'Balanced'


def balanced_num(number):
	if len(str(number)) % 2 == 1:
		mid = len(str(number)) // 2
		return 'Balanced' if sum([int(x) for x in str(number)[:mid]]) == sum([int(x) for x in str(number)[mid + 1:]]) else 'Not Balanced'
	else:
		mid = mid = len(str(number)) // 2
		return 'Balanced' if sum([int(x) for x in str(number)[:mid - 1]]) == sum([int(x) for x in str(number)[mid + 1:]]) else 'Not Balanced'


def balanced_num(number):
	n = str(number)
	L = len(n)
	if L % 2 == 1:
		m = (L - 1) // 2
		n = n[:m] + n[m + 1:]
	else:
		m = L // 2
		n = n[:m - 1] + n[m + 1:]
	L = len(n)
	(left, right) = (n[:L // 2], n[L // 2:])
	if sum([int(i) for i in left]) == sum([int(i) for i in right]):
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	array = [int(x) for x in str(number)]
	if len(array) % 2 == 0:
		print(len(array) // 2)
		print(sum(array[0:len(array) // 2 - 1]))
		if sum(array[0:len(array) // 2 - 1]) == sum(array[len(array) // 2 + 1:]):
			return 'Balanced'
		return 'Not Balanced'
	if sum(array[0:len(array) // 2]) == sum(array[len(array) // 2 + 1:]):
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(numbers):
	args = []
	string_n = str(numbers)
	for i in string_n:
		args.append(int(i))
	last_index = len(args) - 1
	if len(args) % 2 == 0:
		first_index = last_index // 2
		second_index = last_index // 2 + 1
		if sum(args[0:first_index]) == sum(args[second_index + 1:]):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		index = last_index // 2
		if sum(args[0:index]) == sum(args[index + 1:]):
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(num):
	num_string = str(num)
	nums_left_str = ''
	nums_right_str = ''
	left_sum = 0
	right_sum = 0
	return_string = ''
	middle_index = 0
	middle_index = len(num_string) // 2
	if len(num_string) % 2 != 0:
		nums_left_str = num_string[:middle_index]
		nums_right_str = num_string[middle_index + 1:]
		print("it's odd")
	else:
		nums_left_str = num_string[:middle_index - 1]
		nums_right_str = num_string[middle_index + 1:]
		print("it's even")
	print('nums_left_str == ' + nums_left_str)
	print('nums_right_str == ' + nums_right_str)
	for i in range(len(nums_left_str)):
		left_sum += int(nums_left_str[i])
	for i in range(len(nums_right_str)):
		right_sum += int(nums_right_str[i])
	if right_sum == left_sum:
		return_string = 'Balanced'
	else:
		return_string = 'Not Balanced'
	return return_string


def balanced_num(n):
	sn = str(n)
	mn = len(sn) // 2
	fn = sum(map(int, sn[:mn - 1]))
	scn = sum(map(int, sn[mn + 1:]))
	if len(sn) % 2:
		(scn, fn) = (sum(map(int, sn[mn + 1:])), sum(map(int, sn[:mn])))
	print(n, fn, scn)
	return 'Balanced' if n < 100 or fn == scn else 'Not Balanced'


import math

def balanced_num(number):
	num = [int(x) for x in str(number)]
	a = 0
	b = 0
	if len(num) % 2 == 1:
		a = sum(num[:len(num) // 2])
		b = sum(num[len(num) // 2 + 1:])
	else:
		a = sum(num[:len(num) // 2 - 1])
		b = sum(num[len(num) // 2 + 1:])
	if a == b:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(n):
	rs = list(map(int, str(n)))
	if len(rs) == 1 or len(rs) == 2:
		return 'Balanced'
	elif len(rs) % 2 == 0 and len(rs) > 2:
		if sum(rs[:int(len(rs) / 2) - 1]) == sum(rs[-(int(len(rs) / 2) - 1):]):
			return 'Balanced'
		else:
			return 'Not Balanced'
	elif sum(rs[:int(len(rs) / 2)]) == sum(rs[-int(len(rs) / 2):]):
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	print(number)
	s = str(number)
	ln = len(s) // 2
	if len(s) % 2 == 1:
		l = s[:ln]
		r = s[ln + 1:]
	else:
		l = s[:ln - 1]
		r = s[ln + 1:]
	print(('l= ', l, 'r= ', r))
	res = sum([int(x) for x in l]) == sum([int(x) for x in r])
	if res:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	if number <= 99:
		return 'Balanced'
	s = str(number)
	print(number)
	n = int((len(s) - 1) / 2)
	return 'Balanced' if sum((int(c) for c in s[:n])) == sum((int(c) for c in s[-n:])) else 'Not Balanced'


def balanced_num(x):
	b = str(x)
	a = x
	q = 0
	w = 0
	if len(b) % 2 != 0:
		for i in b[0:int(len(b) / 2 - 0.5)]:
			q += int(i)
		for i in b[int(len(b) / 2 + 0.5):]:
			w += int(i)
	else:
		for i in b[0:int(len(b) / 2 - 1)]:
			q += int(i)
		for i in b[int(len(b) / 2 + 1):]:
			w += int(i)
	if q == w:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	num = str(number)
	if len(num) < 3:
		return 'Balanced'
	size = len(num) // 2 - (not len(num) % 2)
	lsum = sum(map(int, num[:size]))
	rsum = sum(map(int, num[-size:]))
	return 'Balanced' if lsum == rsum else 'Not Balanced'


from math import ceil

def balanced_num(number):
	(sum1, sum2) = (0, 0)
	number = list(str(number))
	for i in range(0, int(ceil(len(number) / 2) - 1)):
		sum1 += int(number[i])
		sum2 += int(number[-1 - i])
	if sum1 == sum2:
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	number = [int(n) for n in str(number)]
	sleft = 0
	sright = 0
	while len(number) > 2:
		sleft += number.pop(0)
		sright += number.pop(-1)
	return 'Balanced' if sleft == sright else 'Not Balanced'


def balanced_num(number):
	l = len(str(number))
	a = str(number)[:(l - 1) // 2]
	b = str(number)[l // 2 + 1:]
	if sum((int(i) for i in a)) == sum((int(i) for i in b)):
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	inputlst = list(str(number))
	length = len(str(number))
	if length % 2 != 0:
		middlechartoremove = int(length / 2)
		del inputlst[middlechartoremove]
		inputlst = list(map(int, inputlst))
		oneside = inputlst[middlechartoremove:]
		anotherside = inputlst[:middlechartoremove]
		if sum(oneside) == sum(anotherside):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		middlechartoremove = int(length / 2)
		secondchartoremove = middlechartoremove - 1
		del inputlst[middlechartoremove]
		inputlst = list(map(int, inputlst))
		oneside = inputlst[secondchartoremove + 1:]
		anotherside = inputlst[:secondchartoremove]
		if sum(oneside) == sum(anotherside):
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	n = str(number)
	length = len(n)
	b = sum((int(x) for x in n[:(length - 1) // 2])) == sum((int(x) for x in n[(length + 2) // 2:]))
	string = '' if b else 'Not '
	return f'{string}Balanced'


def balanced_num(number):
	number1 = str(number)
	SliceNumber = int((len(number1) - 1) / 2)
	Left_Of_Middle = list(number1[:SliceNumber])
	Right_Of_Middle = list(number1[len(number1) - SliceNumber:])
	Left_Of_Middle = list(map(int, Left_Of_Middle))
	Right_Of_Middle = list(map(int, Right_Of_Middle))
	if sum(Left_Of_Middle) == sum(Right_Of_Middle):
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	str_n = str(number)
	len_n = len(str_n)
	mid = len_n // 2
	if len_n % 2 != 0:
		flag = sum((int(i) for i in str_n[:mid])) == sum((int(i) for i in str_n[mid + 1:]))
	else:
		flag = sum((int(i) for i in str_n[:mid - 1])) == sum((int(i) for i in str_n[mid + 1:]))
	return 'Balanced' if flag else 'Not Balanced'


def balanced_num(number):
	num = str(number)
	if len(num) % 2 == 0:
		leftind = len(num) / 2 - 1
		rightind = len(num) / 2 + 1
	else:
		leftind = len(num) // 2
		rightind = len(num) / 2 + 1
	l = num[:int(leftind)]
	r = num[int(rightind):]
	if sum((int(x) for x in l)) == sum((int(x) for x in r)):
		return 'Balanced'
	else:
		return 'Not Balanced'


from math import floor

def balanced_num(number):
	summ_1 = 0
	summ_2 = 0
	center = 0
	value = len(str(number))
	if value < 3:
		return 'Balanced'
	if value % 2 == 0:
		center = int(len(str(number)) / 2)
		center_2 = int(len(str(number)) / 2 - 1)
		for i in range(center_2):
			if i != center or i != center_2:
				summ_1 += int(str(number)[i])
				summ_2 += int(str(number)[len(str(number)) - i - 1])
	else:
		center = floor(len(str(number)) / 2)
		for j in range(center):
			if j != int(center):
				summ_1 += int(str(number)[j])
				summ_2 += int(str(number)[len(str(number)) - j - 1])
	if summ_1 == summ_2:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(n):
	n = '0' + str(n) + '0'
	return 'Balanced' if sum(map(int, n[:len(n) // 2 - (len(n) % 2 == 0)])) == sum(map(int, n[len(n) // 2 + 1:])) else 'Not Balanced'


def balanced_num(number: int):
	if len(str(number)) < 3:
		return 'Balanced'
	elif len(str(number)) % 2 == 1:
		(str1, str2) = (str(number)[:len(str(number)) // 2], str(number)[len(str(number)) // 2 + 1:])
	elif len(str(number)) % 2 == 0:
		(str1, str2) = (str(number)[:len(str(number)) // 2 - 1], str(number)[len(str(number)) // 2 + 1:])
	(res1, res2) = (0, 0)
	for i in str1:
		res1 += int(i)
	for i in str2:
		res2 += int(i)
	print((str1, '<->', str2))
	if res1 == res2:
		return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	num_str = str(number)
	length = len(num_str)
	middle = int(length // 2)
	if length % 2 == 0:
		left = 0
		right = 0
		for i in range(0, middle - 1, 1):
			left += int(num_str[i])
		for j in range(middle + 1, length, 1):
			right += int(num_str[j])
		if left == right:
			return 'Balanced'
		else:
			return 'Not Balanced'
	if length % 2 != 0:
		left = 0
		right = 0
		for i in range(0, middle, 1):
			left += int(num_str[i])
		for j in range(middle + 1, length, 1):
			right += int(num_str[j])
		if left == right:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	nums = str(number)
	if len(nums) < 3:
		return 'Balanced'
	if len(nums) % 2 == 0:
		mid = (len(nums) - 1) // 2
		rigth_num = nums[mid:]
		left_num = nums[:mid]
		r_sum = [int(i) for i in list(rigth_num[2:])]
		l_sum = [int(i) for i in list(left_num)]
		if sum(l_sum) == sum(r_sum):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		mid = len(nums) // 2
		r_sum = [int(i) for i in list(nums[:mid])]
		l_sum = [int(i) for i in list(nums[mid + 1:])]
		if sum(l_sum) == sum(r_sum):
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	CountNombers = len(str(number)) // 2 - 1 if len(str(number)) % 2 == 0 else len(str(number)) // 2
	LeftPart = [int(k) for k in str(number)[:CountNombers]]
	RightPart = [int(k) for k in str(number)[:CountNombers:-1]]
	return 'Balanced' if sum(LeftPart) == sum(RightPart) and len(LeftPart) == len(RightPart) or (sum(LeftPart) == sum(RightPart[:-1]) and len(LeftPart) == len(RightPart) - 1) else 'Not Balanced'


def balanced_num(number):
	if number < 100:
		return 'Balanced'
	else:
		(a1, a2) = (0, 0)
		if len(str(number)) % 2 == 0:
			for i in range(0, len(str(number)) // 2 - 1):
				a1 += int(str(number)[i])
				a2 += int(str(number)[len(str(number)) - i - 1])
		else:
			for i in range(0, len(str(number)) // 2 + 1):
				a1 += int(str(number)[i])
				a2 += int(str(number)[len(str(number)) - i - 1])
		if a1 == a2:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	middle = len(str(number)) // 2 - 1 if len(str(number)) % 2 == 0 else len(str(number)) // 2
	first_half = [int(i) for i in str(number)][:middle]
	second_half = [int(i) for i in str(number)][::-1][:middle]
	return 'Balanced' if sum(first_half) == sum(second_half) or number < 100 else 'Not Balanced'


def balanced_num(number):
	list = [int(digits) for digits in str(number)]
	even_lower = len(list) // 2 - 1
	even_upper = len(list) // 2
	index_odd = (len(list) - 1) // 2
	for nums in list:
		if len(list) % 2 == 0:
			if sum(list[:even_lower]) == sum(list[even_upper + 1:]):
				return 'Balanced'
			else:
				return 'Not Balanced'
		if len(list) % 2 == 1:
			if sum(list[:index_odd]) == sum(list[index_odd + 1:]):
				return 'Balanced'
			else:
				return 'Not Balanced'


def balanced_num(number):
	x = str(number)
	z = [int(i) for i in x]
	if len(z) <= 2:
		return 'Balanced'
	elif len(z) == 3:
		return 'Balanced' if z[0] == z[-1] else 'Not Balanced'
	elif len(z) > 3 and len(z) % 2 == 0:
		middle_1 = int(len(z) / 2) - 1
		middle_2 = int(len(z) / 2)
		(first, mid, second) = (z[:middle_1], z[middle_1:middle_2 + 1], z[middle_2 + 1:])
		return 'Balanced' if sum(first) == sum(second) else 'Not Balanced'
	elif len(z) > 3 and len(z) % 2 != 0:
		middle = int(len(z) // 2)
		(first, mid, second) = (z[:middle], z[middle], z[middle + 1:])
		return 'Balanced' if sum(first) == sum(second) else 'Not Balanced'


def balanced_num(number):
	string = str(number)
	length = len(string)
	left = None
	right = None
	if length % 2 == 0:
		left = string[:int(length / 2) - 1]
		right = string[int(length / 2) + 1:]
	else:
		left = string[:int(length / 2)]
		right = string[int(length / 2) + 1:]
	sum_left = 0
	for i in left:
		sum_left = int(i) + sum_left
	sum_right = 0
	for j in right:
		sum_right = int(j) + sum_right
	if sum_left == sum_right:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	left_number = 0
	right_number = 0
	number_string = str(number)
	number_length = len(number_string)
	if number_length < 3:
		return 'Balanced'
	else:
		reverse_number = number_string[::-1]
		if number_length % 2 == 0:
			n = 2
		else:
			n = 1
		for i in range(int((number_length - n) / 2)):
			left_number += int(number_string[i])
			right_number += int(reverse_number[i])
		if left_number == right_number:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	if number < 100:
		return 'Balanced'
	array = [int(x) for x in str(number)]
	length = len(array)
	balmiddle = length // 2 - 1 if length % 2 == 0 else length // 2
	leftsum = 0
	rightsum = 0
	for x in range(balmiddle):
		leftsum += array[x]
		rightsum += array[len(array) - x - 1]
	return 'Balanced' if leftsum == rightsum else 'Not Balanced'


def balanced_num(number):
	(sum_left, sum_right) = (0, 0)
	if len(str(number)) % 2 == 0:
		left = str(number)[:len(str(number)) // 2 - 1]
	else:
		left = str(number)[:len(str(number)) // 2]
	right = str(number)[len(str(number)) // 2 + 1:]
	for elem in left:
		sum_left += int(elem)
	for elem in right:
		sum_right += int(elem)
	if sum_left == sum_right:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	n = str(number)
	(a, b) = (0, 0)
	if len(n) <= 2:
		return 'Balanced'
	if len(n) % 2 == 0:
		for i in range(len(n) // 2 - 1):
			a += int(n[i])
		for j in range(len(n) // 2 + 1, len(n)):
			b += int(n[j])
		if a == b:
			return 'Balanced'
	else:
		for i in range(len(n) // 2):
			a += int(n[i])
		for j in range(len(n) // 2 + 1, len(n)):
			b += int(n[j])
		if a == b:
			return 'Balanced'
	return 'Not Balanced'


def balanced_num(number):
	numbers_array = [int(num) for num in str(number)]
	if len(numbers_array) % 2:
		del numbers_array[int(len(numbers_array) // 2 + 0.5)]
	else:
		del numbers_array[len(numbers_array) // 2 - 1:len(numbers_array) // 2 + 1]
	return 'Balanced' if sum(numbers_array[:len(numbers_array) // 2]) == sum(numbers_array[len(numbers_array) // 2:]) else 'Not Balanced'


def balanced_num(number):
	mid = len(str(number))
	if mid % 2 == 0:
		if sum((int(i) for i in str(number)[:mid // 2 - 1])) == sum((int(i) for i in str(number)[mid // 2 + 1:])):
			return 'Balanced'
		else:
			return 'Not Balanced'
	elif sum((int(i) for i in str(number)[:mid // 2])) == sum((int(i) for i in str(number)[mid // 2 + 1:])):
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(n):
	total_lst = [i for i in str(n)]
	if len(total_lst) == 1 or len(total_lst) == 2:
		return 'Balanced'
	break_even = int(len(total_lst) / 2 - 1)
	break_odd = int(len(total_lst) // 2)
	if len(total_lst) % 2 == 0:
		lst1 = [i for i in total_lst[0:break_even]]
		lst2 = [i for i in total_lst[-break_even:]]
	else:
		lst1 = [i for i in total_lst[0:break_odd]]
		lst2 = [i for i in total_lst[-break_odd:]]
	for i in range(0, len(lst1)):
		lst1[i] = int(lst1[i])
	for i in range(0, len(lst2)):
		lst2[i] = int(lst2[i])
	a = sum(lst1)
	b = sum(lst2)
	if a == b:
		return 'Balanced'
	else:
		return 'Not Balanced'


def balanced_num(n):
	print(n)
	b = list(str(n))
	a = [int(x) for x in b]
	c = len(a)
	if c == 1 or c == 2:
		return 'Balanced'
	if c % 2 == 0:
		a.pop(c // 2)
		c -= 1
	return 'Balanced' if sum(a[:c // 2]) == sum(a[c // 2 + 1:]) else 'Not Balanced'


def balanced_num(number):
	number = str(number)
	str_sum = lambda xs: sum(map(int, xs))
	return 'Balanced' if str_sum(number[:(len(number) - 1) // 2]) == str_sum(number[(len(number) + 2) // 2:]) else 'Not Balanced'


def balanced_num(number):
	ns = str(number)
	nlen = len(ns)
	nmid = nlen // 2
	return ['Not Balanced', 'Balanced'][sum((int(c) for c in ns[:nmid - 1 + nlen % 2])) == sum((int(c) for c in ns[nmid + 1:]))]


def balanced_num(number):
	a = str(number)
	if len(a) % 2 != 0:
		n = len(a) // 2
		sum1 = 0
		sum2 = 0
		for i in range(n):
			sum1 += int(a[i])
		for i in range(n + 1, len(a)):
			sum2 += int(a[i])
		if sum1 == sum2:
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		n = len(a) // 2
		sum1 = 0
		sum2 = 0
		for i in range(n - 1):
			sum1 += int(a[i])
		for i in range(n + 1, len(a)):
			sum2 += int(a[i])
		if sum1 == sum2:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	print(number)
	if len(str(number)) % 2 == 0:
		lst = list(str(number))
		lst = list(map(int, lst))
		cnt = 0
		cnt1 = 0
		for i in range(len(lst)):
			if i < len(lst) // 2 - 1:
				cnt += lst[i]
			elif i > len(lst) // 2:
				cnt1 += lst[i]
		print((cnt, cnt1))
		if cnt == cnt1:
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		lst = list(str(number))
		lst = list(map(int, lst))
		cnt = 0
		cnt1 = 0
		for i in range(len(lst)):
			if i < len(lst) // 2:
				cnt += lst[i]
			elif i > len(lst) // 2:
				cnt1 += lst[i]
		print((cnt, cnt1))
		if cnt == cnt1:
			return 'Balanced'
		else:
			return 'Not Balanced'


def balanced_num(number):
	number = str(number)
	a = len(number)
	hm1 = number[:int(a / 2 - 1)]
	hm2 = number[int(a // 2 + 1):]
	hm3 = number[:int(a // 2 + 1)]
	hm4 = number[int(a // 2):]
	print
	if a == 1:
		return 'Balanced'
	elif a % 2 == 0:
		if sum((int(x) for x in hm1)) == sum((int(y) for y in hm2)):
			return 'Balanced'
		else:
			return 'Not Balanced'
	elif a % 2 != 0:
		if sum((int(w) for w in hm3)) == sum((int(z) for z in hm4)):
			return 'Balanced'
		else:
			return 'Not Balanced'
	else:
		return 'Not Balanced'


def balanced_num(number):
	l = str(number)[:(len(str(number)) + 1) // 2 - 1]
	r = str(number)[len(str(number)) // 2 + 1:]
	if sum([int(x) for x in l]) == sum([int(x) for x in r]):
		return 'Balanced'
	return 'Not Balanced'