fork download
  1. def checkAuto(a):
  2. if a < 0: a = -a
  3. squareNum = a*a
  4. temp = a
  5. count = 0
  6. while temp != 0:
  7. count += 1
  8. temp = int(temp/10)
  9. lastDigit = squareNum%pow(10, count)
  10. if lastDigit == a:
  11. return "Automorphic"
  12. else:
  13. return "Not Automorphic"
  14. num = -4
  15. print(checkAuto(num))
  16.  
Success #stdin #stdout 0.03s 9628KB
stdin
Standard input is empty
stdout
Not Automorphic