So i have easy program that will tell me if this Pythagorean theorem a2 + b2 = c2 is true or false.
But there is one problem if I try to activate it like 2 times without typing something program will fail Is there anything how to fix it.
a=int(input("enter a number a:"))
b=int(input("enter a number b:"),)
c=int(input("enter a number c:"),)
result= (((a**2)+(b**2)) == (c**2))
print(f"result = {result}")
here is error ValueError:
invalid literal for int() with base 10:
It sounds like you just pressed Enter without typing any numbers. If you do that then
input()will return an empty string andint("")will cause the error. This is becauseintexpects a valid numerical string passed to it.To solve the problem, you need to disallow empty input. You can add error handling with a while loop to check the entered value and ask the user to enter a correct value.