I have tried looking around for an answer however the questions on here either seemed to advanced (I'm new to Python) or because of redefining what something meant which I couldn't catch in my script. Here is the code-
a = float(input("Enter the length(in inches)"))
b = float(input("Enter the width(in inches)"))
print ()
print ("The area of your shape is: "(a*b))
I am getting the error TypeError: 'str' object is not callable.
It is a simple script, I know, but it's a work in progress.
Assuming you're using Python 3,
print ("The area of your shape is: ", (a*b))
# ^
You forgot a comma.
You can print the value either with:
print ("The area of your shape is: ", (a*b))
or with
print ("The area of your shape is: {}".format(a*b))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With