0

The command prompt says TypeError: 'str' object is not callable. It highlights these two separate lines of code.

height = float(input('Please enter your height input meters(decimals): '))

height = int(input('Please enter your height input inputches(whole number: '))
3
  • 11
    Did you define a variable named input somewhere in your code? Commented Dec 5, 2013 at 22:35
  • 1
    Those two lines work fine by themselves, so you might have to add more of your code, and check that the problem shows up when running the code in a fresh session. As Ashwini says, creating a variable called input looks like a likely cause of this issue. Commented Dec 5, 2013 at 22:36
  • 1
    yes there's a variable called input Commented Dec 5, 2013 at 22:37

1 Answer 1

6

Now you see why you should never name a variable after a built-in. ;)

You said yourself that you made a variable named input elsewhere in the code. Judging by your error, you must have done this before those two lines. Also, you must have made this variable hold a string.

By doing this, you overshadowed the built-in input. This means that, when you get to those two lines, input no longer exists as the built-in. Instead, it is a string.

Finally, placing (...) after input throws an error because you can't call a string like a function.

Summed up, you can fix the problem by simply picking a different name for that variable besides input.

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

2 Comments

Thank you! The program runs fine now!
@oneabdi - Happy to have helped! Please don't forget to accept my answer (click the check) so that people know this question is answered.

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.