# Definition

A **number** is called **_Automorphic number_** if and only if *its square ends in the same digits as the number itself*.
___

# Task

**_Given_** a **number** *determine if it Automorphic or not* .
___

# Warm-up (Highly recommended)

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

# Notes 

* The **_number_** passed to the function is **_positive_** 

* **_Single-digit_** numbers are considered **_Automorphic number_**.
___
# Input >> Output Examples 

```
autoMorphic (25) -->> return "Automorphic" 
```
## **_Explanation_**:

* `25` squared is `625` , **_Ends with the same number's digits which are 25_** .
___
```
autoMorphic (13) -->> return "Not!!"
```
## **_Explanation_**:

* `13` squared is `169` , **_Not ending with the same number's digits which are 69_** .
___ 
```
autoMorphic (76) -->> return "Automorphic"
```
## **_Explanation_**:

* `76` squared is `5776` , **_Ends with the same number's digits which are 76_** .
___
```
autoMorphic (225) -->> return "Not!!"
```
## **_Explanation_**:

* `225` squared is `50625` , **_Not ending with the same number's digits which are 225_** .
___ 
```
autoMorphic (625) -->> return "Automorphic"
```
## **_Explanation_**:

* `625` squared is `390625` , **_Ends with the same number's digits which are 625_** .
___ 
```
autoMorphic (1) -->> return "Automorphic"
```
## **_Explanation_**:

* `1` squared is `1` , **_Ends with the same number's digits which are 1_** .
___
```
autoMorphic (6) -->> return "Automorphic"
```
## **_Explanation_**:

* `6` squared is `36` , **_Ends with the same number's digits which are 6_** 
___
___

# [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 automorphic(n):
	

Solutions:
def automorphic(n):
	return 'Automorphic' if str(n * n).endswith(str(n)) else 'Not!!'


def automorphic(n):
	return ('Not!!', 'Automorphic')[str(n ** 2).endswith(str(n))]


def automorphic(n):
	return 'Automorphic' if n == n ** 2 % 10 ** len(str(n)) else 'Not!!'


def automorphic(n):
	n2 = n * n
	return 'Automorphic' if str(n) == str(n2)[-len(str(n)):] else 'Not!!'


def automorphic(n):
	result = n ** 2
	if str(n) in str(result):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	pow = 10 ** len(str(n))
	return 'Automorphic' if n == n * n % pow else 'Not!!'


def automorphic(n):
	l = len(str(n))
	return 'Automorphic' if n * n % 10 ** l == n else 'Not!!'


automorphic = lambda n: ['Not!!', 'Automorphic'][str(n ** 2).endswith(str(n))]


def automorphic(n):
	return ('Not!!', 'Automorphic')[str(n ** 2)[-len(str(n)):] == str(n)]


def automorphic(n):
	return ['Not!!', 'Automorphic'][str(n) in str(n ** 2)]


def automorphic(n):
	(n, s) = (str(n), str(n * n))
	return 'Automorphic' if n == s[len(n) * -1:] else 'Not!!'


def automorphic(n):
	s = str(n)
	t = str(n * n)
	return 'Automorphic' if t[-len(s):] == s else 'Not!!'


def automorphic(n):
	return 'Automorphic' if n in [0, 1, 5, 6, 25, 76, 625, 376, 9376, 90625, 890625, 109376, 2890625, 7109376, 12890625, 87109376, 212890625, 787109376, 8212890625, 1787109376] else 'Not!!'


def automorphic(n):
	return ('Automorphic', 'Not!!')[(n ** 2 - n) % 10 ** len(str(n)) and 1]


def automorphic(n):
	return 'Automorphic' if str(n) in str(n ** 2)[-len(str(n)):] else 'Not!!'


def automorphic(n):
	return 'Automorphic' if n == int(str(n * n)[-len(str(n)):]) else 'Not!!'


def automorphic(n):
	l = len(str(n))
	return 'Automorphic' if str(n) == str(n ** 2)[-l:] else 'Not!!'


def automorphic(n):
	return {True: 'Automorphic', False: 'Not!!'}[str(n) == str(n ** 2)[-len(str(n)):]]


def automorphic(n):
	if n == 1 or n == 25:
		return 'Automorphic'
	return 'Automorphic' if str(n ** 2)[len(str(n)):] == str(n) else 'Not!!'


def automorphic(n):
	print(n)
	if str(n ** 2)[-len(str(n)):] == str(n):
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	res = n ** 2
	if str(n) in str(res):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	s1 = str(n ** 2)
	if s1.endswith(str(n)):
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	print(n)
	print(str(n ** 2))
	print(str(n ** 2 - n)[-1])
	print(str(n ** 2 - n))
	if n < 10:
		if str(n ** 2 - n)[-1] == '0':
			print(n ** 2)
			return 'Automorphic'
	if n > 9 and n < 100:
		if str(n ** 2 - n)[-1] == '0' and str(n ** 2 - n)[-2] == '0':
			print(n ** 2)
			return 'Automorphic'
	if n > 100:
		if str(n ** 2 - n)[-1] == '0' and str(n ** 2 - n)[-2] and (str(n ** 2 - n)[-3] == '0'):
			print()
			print(n ** 2)
			return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	end_n = str(n)
	sq = n * n
	end_sq = str(sq)
	end_sq = end_sq[len(end_sq) - len(end_n):]
	if end_n == end_sq:
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	result = {True: 'Automorphic', False: 'Not!!'}
	square = str(n ** 2)
	number = str(n)
	return result[number == square[-len(number):]]


def automorphic(n):
	ls = n ** 2
	return 'Automorphic' if str(n) == str(n ** 2)[-len(str(n)):] else 'Not!!'


def automorphic(n):
	a = len(str(n))
	q = str(n ** 2)
	a1 = len(q)
	return 'Automorphic' if str(n) == q[a1 - a:] else 'Not!!'


def automorphic(n):
	if n == 1:
		return 'Automorphic'
	else:
		x = str(int(n ** 2))
		n = str(n)
		print(x[len(x) - len(n):])
		if n != x[len(x) - len(n):]:
			return 'Not!!'
		else:
			return 'Automorphic'


def automorphic(n):
	total = n * n
	total_lst = [i for i in str(total)]
	check_lst = [i for i in str(n)]
	back = len(check_lst)
	if check_lst == total_lst[-back:]:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	n1 = len(str(n))
	n2 = n * n
	n3 = str(n2)
	if int(n3[-int(n1):]) == n:
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	squared = n ** 2
	squared_str = str(squared)
	len_n = len(str(n))
	ends = int(squared_str[-int(len_n):])
	val = 'Automorphic' if ends == n else 'Not!!'
	return val


def automorphic(n):
	square_num = str(n ** 2)
	num_size = len(str(n))
	if square_num[-num_size:] == str(n):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	x = n ** 2
	return 'Automorphic' if str(n) in str(x) else 'Not!!'


def automorphic(n):
	size = len(str(n))
	return 'Automorphic' if str(n * n)[-size:] == str(n) else 'Not!!'


def automorphic(n):
	flag = str(n ** 2).endswith(str(n))
	return 'Automorphic' if flag else 'Not!!'


def automorphic(n):
	if n == 10:
		return 'Not!!'
	return 'Automorphic' if str(n) in str(n * n) else 'Not!!'


def automorphic(n):
	end = int(str(n ** 2)[-len(str(n)):])
	return 'Automorphic' if end == n else 'Not!!'


def ordern(n):
	p = 1
	while n > 0:
		n = n // 10
		p = p * 10
	return p

def automorphic(n):
	square = n * n
	order = ordern(n)
	if square % order == n:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	n2 = n * n
	if str(n2).find(str(n)) == -1:
		return 'Not!!'
	elif str(n) in str(n2):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	if str(n * n)[-len(str(n)):] == str(n):
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	m = str(n)
	b = str(n ** 2)
	return 'Automorphic' if b[slice(len(b) - len(m), len(b), 1)] == m else 'Not!!'


def automorphic(n):
	square = str(n * n)
	n = str(n)
	last_digits = square[-len(n):]
	if last_digits == n:
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	a = n * n
	b = list(str(a))
	c = list(str(n))
	if len(c) == 1:
		if b[-1] == c[-1]:
			return 'Automorphic'
		else:
			return 'Not!!'
	elif len(c) == 2:
		if b[-1] == c[-1] and b[-2] == c[-2]:
			return 'Automorphic'
		else:
			return 'Not!!'
	elif len(c) == 3:
		if b[-1] == c[-1] and b[-2] == c[-2] and (b[-3] == c[-3]):
			return 'Automorphic'
		else:
			return 'Not!!'
	elif len(c) == 4:
		if b[-1] == c[-1] and b[-2] == c[-2] and (b[-3] == c[-3]) and (b[-4] == c[-4]):
			return 'Automorphic'
		else:
			return 'Not!!'
	elif len(c) == 5:
		if b[-1] == c[-1] and b[-2] == c[-2] and (b[-3] == c[-3]) and (b[-4] == c[-4]) and (b[-4] == c[-4]):
			return 'Automorphic'
		else:
			return 'Not!!'


def automorphic(n):
	n_sqr_str = str(n ** 2)
	return 'Automorphic' if n_sqr_str[-len(str(n)):] == str(n) else 'Not!!'


def automorphic(num):
	squared = num ** 2
	squared = str(squared)
	num = str(num)
	if squared.endswith(num):
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	s = n ** 2
	s = str(s)
	if s[-len(str(n)):] == str(n):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	lth = len(str(n))
	last = str(n ** 2)[-lth:]
	if str(n) == last:
		return 'Automorphic'
	else:
		return 'Not!!'


true = 'Automorphic'
false = 'Not!!'

def automorphic(n):
	return true if str(n) == str(n * n)[-len(str(n)):] else false


def automorphic(n):
	return {0: 'Not!!', 1: 'Automorphic'}[str(n * n)[-len(str(n)):] == str(n)]


def automorphic(n):
	f = list(map(int, str(n)))
	z = list(map(int, str(n ** 2)))
	m = len(f)
	if f[:] == z[-m:]:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	cpy = str(n)
	n_square = n ** 2
	n_square = str(n_square)
	if n_square.endswith(cpy):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(number):
	data = str(number)
	res = str(number ** 2)
	l = len(data)
	return 'Automorphic' if res[-l:] == data else 'Not!!'


def automorphic(n):
	charLength = len(str(n))
	squared = str(n ** 2)
	automorphicTest = int(squared[-charLength:])
	if automorphicTest == n:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	x = len(str(n))
	sq = str(n ** 2)
	return 'Automorphic' if sq[-x:] == str(n) else 'Not!!'


def automorphic(n):
	square = n ** 2
	return 'Automorphic' if str(n)[::-1] == str(square)[::-1][:len(str(n))] else 'Not!!'


def automorphic(n):
	return ['Not!!', 'Automorphic'][all((a == b for (a, b) in zip(str(n)[::-1], str(n ** 2)[::-1])))]


def automorphic(num):
	return 'Automorphic' if str(num * num).endswith(str(num)) else 'Not!!'


def automorphic(n):
	list = [num for num in str(n ** 2)]
	if str(n) in ''.join(list[-len(str(n)):]):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	new_n = n ** 2
	n = str(n)
	new_n = str(new_n)
	if new_n[-len(n):] == n:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(number):
	num = number
	squ = num ** 2
	str_num = str(num)
	str_squ = str(squ)
	len_num = len(str_num)
	len_squ = len(str_squ)
	i = len_squ - len_num
	j = 0
	return_value = 0
	for i in range(len_squ - len_num, len_squ):
		if str_num[j] != str_squ[i]:
			return_value += 1
		i += 1
		j += 1
	if return_value == 0:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	square = str(n * n)
	convertedN = len(str(n))
	return 'Automorphic' if square[-convertedN:] == str(n) else 'Not!!'


def automorphic(n):
	kvad = n ** 2
	m = []
	stroki = str(n)
	stroka = str(kvad)
	mass = list(stroka)
	leni = len(stroka)
	leni2 = len(stroki)
	mass = list(reversed(mass))
	while leni != leni2:
		leni = leni - 1
		mass.pop()
	mass = list(reversed(mass))
	b = str(n)
	b = list(b)
	if b == mass:
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	suka = str(n)
	print(suka, ' SUKA', len(suka))
	blyat = str(n ** 2)
	print(blyat, ' BLYAT', blyat[-len(suka):])
	if suka == blyat[-len(suka):]:
		print('YES')
		return 'Automorphic'
	else:
		print('Not')
		return 'Not!!'


def automorphic(n):
	i = n
	d = 1
	while i >= 1:
		d *= 10
		i /= 10
	if n == n * n % d:
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	squared_number = n ** 2
	if str(squared_number)[-len(str(n)):] == str(n):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	x = n ** 2
	c = len(str(x))
	for i in str(n)[::-1]:
		if i != str(x)[c - 1]:
			return 'Not!!'
		c -= 1
	return 'Automorphic'


automorphic = lambda n: ('Automorphic', 'Not!!')[n != int(str(n * n)[-len(str(n)):])]


def automorphic(n):
	squared = str(n ** 2)
	n = str(n)
	if squared[-len(n):] == n:
		return 'Automorphic'
	return 'Not!!'


def automorphic(n):
	return 'Automorphic' if f'{n * n}'.endswith(f'{n}') else 'Not!!'


automorphic = lambda n: 'Automorphic' if n == int(str(n ** 2)[-len(str(n)):]) else 'Not!!'


def automorphic(n):
	a = [int(x) for x in str(n)]
	b = [int(x) for x in str(n * n)]
	for i in range(1, len(a) + 1):
		if a[len(a) - i] != b[len(b) - i]:
			return 'Not!!'
	return 'Automorphic'


def automorphic(n):
	ns = str(n)
	nsq = str(n ** 2)
	return 'Automorphic' if nsq[-len(ns):] == ns else 'Not!!'


def automorphic(n):
	number = str(n ** 2)[-len(str(n)):]
	return 'Automorphic' if number == str(n) else 'Not!!'


def automorphic(n):
	strnum = str(n)
	lenstr = len(strnum)
	strnumsqr = str(n * n)
	if strnumsqr.endswith(strnum):
		return 'Automorphic'
	else:
		return 'Not!!'


def automorphic(n):
	pow_n = n ** 2
	result = str(pow_n)[-len(str(n)):]
	return 'Automorphic' if int(result) == n else 'Not!!'


def automorphic(n):
	num = list(map(int, str(n ** 2)))
	num = num[::-1]
	num2 = list(map(int, str(n)))
	num2 = num2[::-1]
	for i in range(len(num2)):
		if num2[i] == num[i]:
			continue
		else:
			return 'Not!!'
	return 'Automorphic'


def automorphic(n):
	n1 = len(str(n))
	sqr = str(n ** 2)
	if int(sqr[-n1:len(sqr)]) == n:
		return 'Automorphic'
	else:
		return 'Not!!'


import re

def automorphic(n):
	return 'Automorphic' if str(n) == str(n ** 2)[-len(str(n)):] else 'Not!!'


import re

def automorphic(n):
	reg = re.compile('.*%s$' % n)
	if reg.search(str(n * n)) != None:
		return 'Automorphic'
	return 'Not!!'