chevron_left chevron_right

• 0 Vote(s) - 0 Average

 Pythagorean Theorem Calculator filter_list Linear Mode Threaded Mode View a Printable Version Author Message
RE: Pythagorean Theorem Calculator #11
(11-09-2013, 04:24 AM)Tear Wrote:
Code:
```sta = leg1 * leg1 + leg2 * leg2 answ = math.sqrt(sta) print(answ, "is the length of the hypotenuse.");```

Code:
```ans = math.sqrt(leg1**2 + leg2**2) print( str(ans) + " is the length of the hypotenuse.");```

Good.

Don't create unnecessary variables.
Use operators that make it easy to understand what it is you are doing( in my code, it is immediately clear that I am getting the square root of the sum of leg1 squared and leg2 squared )

RE: Pythagorean Theorem Calculator #12
Nice piece, made one of these a while back, but this is more...structured.

RE: Pythagorean Theorem Calculator #13
(11-09-2013, 04:38 AM)Feat Wrote: "I own everything that will come into existence"

You got burned. Feat owns you now...

I for one know *almost* nothing about Python but I would not need a special calculator to work out Pythagoras theorem.

Pythagorean Theorem Calculator #14
Make it ask for 3 inputs, leg 1 leg 2 and hypotenuse, and find the value of the one with a "?" Input.
#MakeSinisterlySexyAgain

Users browsing this thread: 1 Guest(s)