November 20th, 2003, 10:46 PM
Join Date: Nov 2003
Time spent in forums: < 1 sec
Reputation Power: 0
Must crawl before I can walk. Help with a basic python program!
I am taking an intro class into programming, and I need some help. I have to create an array that is x-number of cells long (I'm using 10 for now because it is small. I then have to create a program that will take a base ten number and convert it into binary using the "divide by 2 and take the remainder" method. This is not a problem. My problem is that I then have to print the array backwards, starting with the last number that was put into the array. I can't figure it out! Here is my main program and some of the various print options (I have been using the command "print value" merely to test that the binary conversion was working fine. Can anyone help me on this? Thanks!
PS I know this is so incredibly simple, but it is my first time programming anything so please bear with me.
PPS My indents did not carry over into the forum posting, sorry.
n=input("enter a number to convert to binary")
while i > 0 and a>=0:
# print counter
# while i>=counter:
# counter = counter -1
# print "The number ",n, " in binary is ",[i]
Last edited by Mock26 : November 20th, 2003 at 10:50 PM.