+ 2

Can anyone refer me any code for Pythagoras Theorem in python ? I'm having some problems coding it !!

I am having a problem in the formula. Where hypotenuese squared = Perpendicular squared + Base squared. I cant add equals to in the formula as it is used as an assignment operator in python.

17th Feb 2019, 9:33 AM
Daniyal
Daniyal - avatar
11 Antworten
+ 4
Equals in most programming languages is written like this: ==
17th Feb 2019, 9:39 AM
HonFu
HonFu - avatar
+ 3
If you just want to calculate the hypotenuse: https://code.sololearn.com/c1ZBoIe3iKQz/?ref=app
17th Feb 2019, 10:25 AM
Tibor Santa
Tibor Santa - avatar
+ 2
a = int(input()) This is how you can get a numeric value from the user. But these are the very basics which are covered in the python lessons, so I really recommend that you start reviewing those first!
17th Feb 2019, 10:41 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Ok great, then I don't understand what you are trying to accomplish with the formula and what your actual question is. :) please post your code that is not working as intended, so we might understand better.
17th Feb 2019, 10:45 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Daniyal , the questions you ask don't support your claim to 'know almost everything about' Python. Please don't misrepresent yourself here because that makes it very hard for us to help you.
17th Feb 2019, 10:52 AM
HonFu
HonFu - avatar
+ 1
Have you written this in another language? (Seeing it might help me see what's your problem.)
17th Feb 2019, 10:24 AM
HonFu
HonFu - avatar
+ 1
I know python very well, I know almost everything about it.. how to take input, define functions, constructors.... I am just having a problem with my Formula construction
17th Feb 2019, 10:42 AM
Daniyal
Daniyal - avatar
+ 1
my bad, about what I quoted but I have worked with python alot and I am familiar with many things in python !!
17th Feb 2019, 10:56 AM
Daniyal
Daniyal - avatar
0
I know that equals to is written like that but it isn't solving the formula
17th Feb 2019, 10:04 AM
Daniyal
Daniyal - avatar
0
Tibor Santa How about if we have to take input from the user ? Then you have to provide the formula in the code. How about that ?
17th Feb 2019, 10:37 AM
Daniyal
Daniyal - avatar
- 1
I'll post my code for your understanding !!
17th Feb 2019, 10:57 AM
Daniyal
Daniyal - avatar