2

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.

0

2 Answers 2

11

Assuming you're using Python 3,

print ("The area of your shape is: ", (a*b))
#                                   ^

You forgot a comma.

Sign up to request clarification or add additional context in comments.

Comments

1

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))

1 Comment

or if you want it to work as far back as python 2.6, "{0}".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.