
This post has NOT been accepted by the mailing list yet.
Complete novice here trying to learn. I am supposed to create a module which I believe I have done here:
import math
def circum(x):
return 2 * math.pi * x (format (",.3f"))
def area(x):
return math.pi * x **2 (format (",.3f"))
I have named this module mycircle. Now I have to import this module and use it to calculate the circumference and area of a circle. My code for this is:
import mycircle
def main():
radius = float (input ("Please enter the radius of the circle: "))
circumference = mycircle.circum (radius)
area = mycircle.area (radius)
print ("The circumference of the circle is ", format (mycircle.circum, ",.3f"), sep="")
print ("The area of the circle is ", format (mycircle.area, ",.3f"), sep="")
main()
However, I am receiving the error:
File "C:/Users/Jameson/Desktop/COP 1000/Chapter 5/54.py", line 26, in <module> main()
File "C:/Users/Jameson/Desktop/COP 1000/Chapter 5/54.py", line 21, in main
circumference = mycircle.circum (radius)
File "C:/Users/Jameson/Desktop/COP 1000/Chapter 5\mycircle.py", line 4, in circum
return 2 * math.pi * x (format (",.3f"))
TypeError: 'float' object is not callable
I can only assume that it is something dumb. Any help would be greatly appreciated! I am stuck here.
