while loop - Small python program - Binary string to Decimal integer converter stuck -


just making code converts 4 bit binary value denary. have done far, keep getting syntax errors , highlighting >.

answer = 0 column = 8 while column not < 1:     bit = int(input("enter bit value: "))     answer = answer + (column * bit)     column = column/2 elif column < 1:     print("decimal value " + str(answer)) 

question similar binary string decimal integer converter wasnt helpful.

thanks,

there no not > operator in python. you're trying saying <=.

anyway, looks you're doing wrong here. maybe helps:

while column >= 1:     try:         bit = int(input("enter bit value: "))         answer = answer + (column * bit)         column = column/2     except valueerror:         print "wrong input"      print("decimal value " + str(answer)) 

the elif doesn't make sense both logically , syntacticly.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -