How to display the binary form of digital template parameters in the question text?

Re: How to display the binary form of digital template parameters in the question text?

de către Hongchuan Liu-
Număr de răspunsuri: 0
{% set ndecimal = random(15, 20) %}
{% set n = ndecimal %}
{% set binary = "" %}
{% for i in range(0, 15) %}
{%    if n >0 %}
{%        set binary = (n % 2) ~ binary %}
{%        set n = n // 2 %}
{%     endif %}
{% endfor %}
{ "num":"{{ ndecimal }}","bin":"{{binary}}"}

I put the above  in the template parameters and it works well. 

Thanks a lot.