I have a project where i have to translate binary to hex. and decimal
Here is the code, it might not be that pretty any help is greatly appreciated: the thing is that when i put in a 1 or a 0 it still gives me: There is an error please re-type your binary number. (one's and zero's) from my code
binary = raw_input("What Binary up to 8-bits would you like to use?")
if len(binary) <= 8:
for b in range(1,len(binary)+1):
if b ==2 or b==3 or b==4 or b==5 or b==6 or b==7 or b==8 or b==9:
print "**There is an error please re-type your binary number. (one's and zero's)**"
else:
print "Your code is too long! it needs to be 8 or less characters to
proccess!"
Aucun commentaire:
Enregistrer un commentaire