← Back to challenges

Automorphic Number

PythonMediumlogicmathnumbersvalidation

Instructions

A number is called Automorphic number if its square ends in the original number. Create a function that takes a number n and returns True if it is an Automorphic number, otherwise False.

Examples

automorphic(1) ➞ True

automorphic(3) ➞ False
# 3^2 = 9

automorphic(6) ➞ True
# 6^2 = 36 (ends with 6)

automorphic(95) ➞ False
# 95^2 = 9025 (does not end with 95)

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Cleaning Up Messy Lists