Why is my decimal to binary program returning the value backwards and in a table format?
<p>I'm using python 3.5.2 to make this program. It'supposed to take any decimal number and convert it to binary.</p>

<pre><code>number = int(input('Enter a number in base 10: '))
base2 = ''
while(number &gt; 0):
     rem = number % 2
     number = number // 2
     base2 = srt(number) + str(rem)
     print(rem)
#This was to prevent the end text from sticking to the print
input('\nEnter to end')
</code></pre>

<p>It returns the correct values, but backwards and in a column and I don't know why.</p>

<p>Some modifications to your code:</p>

<pre><code>number = int(input('Enter a number in base 10: '))
base2 = ''
while(number &gt; 0):
    rem = number % 2
    number = number // 2 # can be number //= 2, or number &gt;&gt;= 1 
    base2 += str(rem)
    #print(rem) # no need to print
print(base2[::-1])
</code></pre>

<p>Or more simple:</p>

<pre><code>base2 = bin(number)[2:]
</code></pre>

python binary decimal converter data-conversion