samedi 28 février 2015

Where is the error in this python3.x code? [on hold]


I'm working on homework for my Concepts of Programming class, and here's my code thus far: http://ift.tt/1vLaOFj Python gives the following error message:



Traceback (most recent call last): File "C:/Users/Corey/Documents/Documents/python/cpFunctionsHW.py", line 14, in print("The area of a square with sides of length 10.3 is ", squareArea(10.3)) File "C:/Users/Corey/Documents/Documents/python/cpFunctionsHW.py", line 13, in squareArea return rectangleArea(length, length) TypeError: 'float' object is not callable



The code successfully executes up to line 11 and says the error is at line 14, but this visualizer: http://ift.tt/1EWGnMf Tells me that the problem is at line 6. Furthermore, altering lines 6 and 7 as such:



rectangleLength = int(input("What is the length of your rectangle? "))


rectangleWidth = int(input("What is the width of your rectangle? "))



gives the following error:



Traceback (most recent call last): File "C:/Users/Corey/Documents/Documents/python/cpFunctionsHW.py", line 14, in print("The area of a square with sides of length 10.3 is ", squareArea(10.3)) File "C:/Users/Corey/Documents/Documents/python/cpFunctionsHW.py", line 13, in >squareArea return rectangleArea(length, length) TypeError: 'int' object is not callable



This has left me utterly baffled, so I'm hoping you guys can help.





Aucun commentaire:

Enregistrer un commentaire