4/15 whats wrong in my code


#1

print 'Welcome to the Pig Latin Translator!'


raw_input("enter a word:")
original=raw_input
print original
   if len(original) > 0:
print original
else:
print "empty"


Replace this line with your code.


#2

Hi @vinod_9196 ,

Is your code indented correctly?

These should be combined into a single statement ...

raw_input("enter a word:")
original=raw_input

See the documentation at Python: raw_input.

In the current version of your code, the second statement in the above simply assigns the raw_input function itself to original. Instead, you need to assign the result of calling the function, as in the first statement in the above, to original.


#3

hi @appylpye

will u please provide me proper code
im confused :expressionless:


#4

Hi, @vinod_9196 ,

The following prompts the user for input, and returns that input as a str ...

raw_input("enter a word:")

... however, it does not save the user's input to a variable, so the input just gets lost.

This merely assigns a reference to the raw_input function to original ...

original=raw_input

... but does not assign the user's input to anything.

To both prompt the user and save the input to a variable, do this ...

original = raw_input("enter a word:")

#5

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