A self-describing number is a number of which the digits in every position indicate the amount of times they occur in the number. Here, the positions of the digits are numbered from left to right starting with 0. The number 2020, for example, is a self-describing number of four digits. Position "0" has 2 as a value and there are a total of 2 zeroes in the number. Position 1 has 0 as a value, 1 doesn't occur in the number. Position 2 has value 2 and the digit occurs twice in the number. Lastly, position 3 has 0 as a value. 3 does not occur in 2020.
Write a function selfdescribing to which a number $$n \in \mathbb{N}$$ must be given as an argument. The function must print a Boolean value as a result, indicating whether the number is self-describing or not.Â
>>> selfdescribing(1210)
True
>>> selfdescribing(1110)
False
>>> selfdescribing(2020)
True
>>> selfdescribing(21200)
True