Binary to decimal: A better Algorithm

'''A better algorithm for binary to decimal''' li=[] bi=str(input()) chr=0 c=0 for i in bi: if i=='1': chr=int(2**c)+chr c+=1 #------done----------------- The advantage of this algorithm is that it would just care about the on states of the binary number thus reducing the time to calculate

Comments