So i just dived in and came up with this to translate the numbers to binary, it’s all good until i try to fill in the 0’s. Now you’ll notice the various self.says in there, those are checking the code is functioning fine. The second to last one gives back the binary number, only reversed and with None instead of 0’s. My problem is, no matter how i format it, it won’t change them. I’ve tried counters with loops or while and fors in all shapes and sizes, but i can only transform ONE of the None’s into a 0, and only if i haven’t reversed the array yet. It’s driving me nuts, what the hell is going on?

Code:

bin = []

def base2(numero):

store = numero

counter = 0

difference = store - Math.pow(2,counter)

counter = -1

clas = 1

while store > 0:

counter = -1

clas = 1

while store/clas >= 1:

clas = 2*clas

counter +=1

self.say(counter)

bin[counter] = 1

store = store - Math.pow(2,counter)

n = 0

self.say(bin)

for n in bin:

if bin[n] == None:

bin[n] = 0

bin2 = bin.reverse()

self.say(bin)

elnum =base2(25)

edit: obviously the code has it’s proper spacing on the actual game.

edit2: self-fixed with

n = len(bin)

m=0

while m < n:

if bin[m] != 1:

bin[m] = 0

m +=1

bin.reverse()

self.say(bin)

i’d still really like to know why what i was doing before wasn’t working