[Tutor] Creating and using module “float object not callable” -Python 3.5.1

BelcherJ87 belcherjames21 at gmail.com
Mon Feb 22 21:35:02 EST 2016


 


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. 
 



--
View this message in context: http://python.6.x6.nabble.com/Creating-and-using-module-float-object-not-callable-Python-3-5-1-tp5184603.html
Sent from the Python - tutor mailing list archive at Nabble.com.


More information about the Tutor mailing list