Dec-08-2019, 10:19 AM
If you have such an error in a compound statement, you must split it to see where exactly the error arises. The message tells you the error is in:
n,exp=int(input("Enter the value of the base:")).split(",")The first part to be executed will be:
input("Enter the value of the base:")When you enter the string: '3,5', this will be replaced with '3,5' in the next stage:
>>> int('3,5') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: '3,5'This gives you the answer: '3,5' is not an integer.
int()
expects one parameter, so the most readable construction would be to split the line into:n,exp=input("Enter the value of the base:").split(",") n = int(n) exp = int(exp)The most