python - Try- except ValueError loop -


def enternumber():     number = input("please enter number convert binary. ")     while true:         try:             int(number)             convertdenary()         except valueerror:             enternumber() def convertdenary():         binarynumber = ['','','','','','','','']         print(enternumber())         if enternumber() > 128:             enternumber() - 128             binarynumber[0] == 1 enternumber() 

the try- except valueerror loop intend however, won't break. i've tried adding in break under int(number), removing while true: , added in convertdenary() see if force subroutine stop , start other still doesn't work.

i infinite loop of "please enter number convert binary." ideas?

def converttobinary(number):    if number > 1:        converttobinary(number//2)    elif number<1:        enternumber()     print(number % 2,end = '')  def enternumber():     number = (input("please enter number convert binary : "))     try:         converttobinary(int(number))     except exception e:         print(e)  enternumber() 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -