Aug-09-2020, 03:20 PM
I think you just want to do this:
https://docs.python.org/3/tutorial/inputoutput.html
Why are you using ast to convert a string to an integer? Immediately after you use int() which will generate an exception, which is what you installed tenacity to handle. Why not do this:
@retry(stop=stop_after_attempt(2)) def starting()There is a lot wrong going on in this bit of code.
print(f"In The Hexadecimal Form: %s" %(int(deci))) print(f"In The Binary Form: %s" %(bin(int(deci,16))))Your print format is all messed up. Read this:
https://docs.python.org/3/tutorial/inputoutput.html
Why are you using ast to convert a string to an integer? Immediately after you use int() which will generate an exception, which is what you installed tenacity to handle. Why not do this:
intval = int(inputstr, base) print(f'In The Hexadecimal Form: {hex(intval)}') print(f'In The Binary Form: {bin(intval)}')Where base is 16 for hexicecimal, 8 for octal and 2 for binary.