Word Up 8/11 Question


#1

I’m not having difficulty with the code, no errors. Here is my code below:

print 'Welcome to the Pig Latin Translator!'

pyg = 'ay'

original = raw_input('Enter a word: ')

if len(original) > 0 and original.isalpha():
  word = original.lower()
  first = word[0]
  print original
else:
  print 'empty'

My assumption is that for the raw input in the console, the first letter is supposed to be printed lowercase- in my case it isn’t. If I enter ‘Test’ it still outputs ‘Test’, isn’t it supposed to output ‘test’? I completed this section with no issues, but for Code Academy to say I’m inputting the correct code, but I’m not seeing it in the console, has me concerned.

Maybe I’m doing something wrong?


#2

you indeed convert to lowercase, the result of this conversion you store in a variable named word

but you print original, which still contains the original string entered by user. If you want to see the result of your work, you will need to make a change to what you are printing


#3

Ah, I see. I changed print original to print word and it takes the functions within the if statement. The instructions do not list that, however; it just has us make a variable within the if statement to:

word = original.lower()
  first = word[0]

Doesn’t ask us to change the print function.


#4

the exercise will ask you later to change print statement, it just assumes you can follow along i guess, and if you do want to see results printed, you will have to change this yourself


#5

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