Pig Latin - Works on computer but not the website?


It seem to work when I run in PyCharmCE but not on the website. ?? Different version of Python? I'm not sure what the problem is. Any ideas?

print("Pig Latin")
word=input("Please input a word \n " )
if len(word)==0:
    print ("This is not valid")
    word=input("Please input a valid word \n")
makeitastring=''.join(map(str, word))
print (makeitastring+"ay")


input is not the same as raw_input(),

this should be word=raw_input("Please input a word \n " )


I looked up what you said and from reading this I think I have Python 3 and my code academy is Python 2 maybe?

In Python 2, raw_input() returns a string, and input() tries to run the input as a Python expression. Since getting a string was almost always what you wanted, Python 3 does that with input() . As Sven says, if you ever want the old behaviour, eval(input()) works.Feb 6, 2011


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