Adam Number

Created by

Take number 31 and its reverse 13, then look at the squares of these two numbers: 961 and 169. You can see that the squares are also reverses of each other.

An Adam number is a number that verifies this property: its square is the reverse of the square of its reverse.

Write the function check_adam_number(num) which takes an integer num and returns True if this number is an Adam number, otherwise False.

Example

>>> check_adam_number(31)
True
>>> check_adam_number(22)
True
>>> check_adam_number(15)
False

Advice

To reverse a number, you can first transform it into str, then reverse it and turn it into int again.

There's no corrections yet, hit the `Submit` button to send your code to the correction bot.

Keyboard shortcuts:

  • Ctrl-Enter: Send your code to the correction bot.
  • Escape: Get back to the instructions tab.

See solutions