Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update circle_area.py #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions circle_area.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# TODO: DEFINE a function using the def keyword called `area_of_circle`
# TODO: implement the function to RETURN (NOT PRINT) the area of a circle whose radius is r
# HINT: You'll need to import math to solve this problem correctly.
import math

def area_of_circle(r): # define a function called area_of_circle which takes an argument called r
area = (r**2) * math.pi # area of any circle is equal to the radius squared, multiplied by pi (where pi is 3.14159....
#print(area) # self test pt 1
return area # return the area of a circle whose radius is r

#area_of_circle(2) # self test pt 2