Check yourself


I'm having issues with the "Check yourself" exercise.

I have the following line of code that prompts me to enter a word in the console.

original = raw_input
if len(original)> 0:
   print original
    print "empty"

When I input a word it throws the following error to me. 

```Traceback (most recent call last):
  File "python", line 3, in <module>
TypeError: object of type 'builtin_function_or_method' has no len()

Any thoughts as to what the issue could be?


@fh89 ,

You omitted the argument to the raw_input function here, which should be a prompt ...

original = raw_input

As a consequence, you are assigning a reference to the raw_input function to original instead of calling the function and acquiring user input.


raw_input needs and argument, for example this would work in your situation:

original = raw_input("Type a word, please: ")

If you don't include the argument, the raw_input is assigned to original instead of actually calling the function.

Happy coding!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.