Code not outputting correctly in PygLatin 4/5/6


#1




-There are no error messages, instead everything I type ends up being "empty", as that's the what I said to print if the word I typed was less than 0 characters. The problem is, if I type Hello, it'll output as empty.

-Also, with the x.isalpha(), whenever I input numbers and letters combined, it still turns up as empty, which is strange because I would expect an error message, since there would be non-letter characters in the code (which is what x.isalpha() checks for...)

I'm still prompted to go onto the next exercise, but I want to see what happens when I type something in the output (I know what should happen, but since it's not happening I feel like I'm doing something wrong).


print 'Welcome to the Pig Latin Translator!'

raw_input("Enter a word")
original = raw_input

original = ""
if len(original) > 0 and original.isalpha():
    print original
else:
    print "empty"


#2

The variable original should refer to what the user entered, not a hard-coded empty string or a function


#3

I see what you mean, so how do I make the variable refer to what the user entered?


#4

You'd need to obtain that data and assign it to the variable

my_var = 5

#5

I am having the same issue with the output always saying "empty". I understand that we need to somehow have it refer back to what was entered, but I am unsure of how to make the variable and where to put it within the code.


#6

There is a function that asks the user for input and returns the result.

How does one call a function and assign the result to a variable? There's nothing special about this, you've done it plenty of times by now.

And if you're not puzzling together how to do this then there's even more reason for me not to spell out how to do it - something is missing that needs addressing. If the above two paragraphs aren't making it incredibly obvious what needs to be done then find out what's stopping you.


#7

I don't really know how to express that without it sounding harsh.
What I mean is that there's some low-hanging fruit of knowledge/understanding here somewhere that you really should grab and with that this input thing is going to be entirely straight-forward
I rarely answer questions directly, rather I try to help with how one would find such an answer


#8

Thank you for your help.


#9

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