Jul-02-2018, 03:51 AM
(This post was last modified: Jul-02-2018, 03:55 AM by Zombie_Programming.)
A way to solve this is to get rid of the
Here's the output:
Also, while I'm still here, you should place your error in error tags, along with the entire error. Like this
ipt.split(" ")
and change your int(input(...))
to eval(input(...))
like I do here,import math def pythag( a, b, c1): if(c1 == 'c') : c = math.sqrt(pow(a, 2) + math.pow(b, 2)) else : c = math.sqrt(pow(a,2) - math.pow(b,2)) return c a,b = eval(input("Pythagorean theorem, Enter sides A and B and I will solve for C\n")) print("Side C is equal to", pythag(a, b,'c')) a,b = eval(input("\nNow enter sides B and C and i will solve for A\n")) print("Side A is equal to", pythag(b, a,'a')) a,b = eval(input("\nFinally, enter sides A and C and i will solve for B\n")) print("Side B is equal to", pythag(b, a,'b'))
Here's the output:
Output:Pythagorean theorem, Enter sides A and B and I will solve for C
3,4
Side C is equal to 5.0
Now enter sides B and C and i will solve for A
4,5
Side A is equal to 3.0
Finally, enter sides A and C and i will solve for B
3,5
Side B is equal to 4.0
Also, while I'm still here, you should place your error in error tags, along with the entire error. Like this
Error:Traceback (most recent call last):
File "C:/Users/bagpi/Desktop/test.py", line 12, in <module>
ipt = int(input("Pythagorean theorem, Enter sides A and B and I will solve for C\n"))
ValueError: invalid literal for int() with base 10: '1 2'