I want to be able to output the area of the circle and the cirumference of the circle to the user. so the output is to be "the area of the circle is... and the circumference of the circle is..." and it has to be to 2dp. the question says i will have to call the circumferenceofCircle and areaOfCircle functions. is this the right way to go?

import math
radius= input("please enter the radius of the cirle: ")
area= float(math.pi*radius**2)
circumference= float(2*math.pi*radius)
print "The area of the circle is,/""area is %.2f and circumference is %.2f. " (radius, circumference)

and can you tell me if this return function is correct?.. the function has to have radius as the parameter and returns the area of circle..

def AreaOfCircle(radius):
    return math.pi * radius**2

Some error in your print line,look at this.

import math
radius = input("please enter the radius of the cirle: ")
area = float(math.pi*radius**2)
circumference = float(2*math.pi*radius)
print "With an input off %s area is %.2f\nand circumference is %.2f" % (radius, area, circumference)

'''My output-->
With an input off 4.78 area is 71.78
and circumference is 30.03
'''

It`s ok.

>>> import math
>>> def AreaOfCircle(radius):
	return math.pi * radius**2

>>> AreaOfCircle(5)
78.539816339744831
>>> AreaOfCircle(5.4587)
93.611310811738718
>>> AreaOfCircle(.4589)
0.66158551506127805
>>> print math.pi
3.14159265359
>>>

But the question asks me to call the functions circumferenceOfCricle and areaOfCircle with my function above.. is this the same?

call the functions circumferenceOfCricle and areaOfCircle

circumferenceOfCricle is not a function as you should see.

To make circumferenceOfCricle to a function

def circumference(radius):
    return float(2*math.pi*radius)

Then try to figure out function call yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.