Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

[py challenge] challenge #1

hey all, this is to test your python skills. (i hope you like them, if i get good feedback i will post more)

questions:

1. Write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the two legs as arguments.

2. Write a function called circle_area that takes in two points (each with an x and a y value) which are the center of a circle and a point on the circumference of the circle and then calculates the area of that circle. An example of the function call would be:
Ex. circle_area(4,1,6,12)

post the source code in Pastebin or if you must you can use the "
Code
and
" tags (code tags)
(Dec 23, 2013 01:38 PM)ImportUsername Wrote:  I would hope that you're not using this for homework under the ruse of a challenge...
Spoiler (Click to View)

the second question you answered looks correct but the anser for the first one should look more like this
Code
import math
def hypotenuse(a,b): #pythagorgas's theorem
    c=a**2+b**2
    hypo=math.sqrt(c) #square roots
    print(hypo)

#hypotenuse(3,4)

also, no its not for homework LOL, im not taking my python course this year.
Spoiler (Click to View)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by -MaxFeb 11, 2013 01:17 PM 13 674 Feb 11, 2013 01:17 PM
Last Post: frenchtoast