Pyglatin 8/11


I passed the 7/11 portion with this code, however it is saying the first letter is now stored.
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

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

I have two questions concerning this:

  1. where is the number stored?
  2. if I enter a word when the code runs with a capitalized letter it still returns as capitalized, is that normal?


the first letter is a letter, not a number. Its stored in first variable, which is quite a good variable name given it holds the first letter of word

well, your program converts it to lowercase, but it still prints original, which is not the variable containing the text which is converted to lowercase


word = original
word = word.lower()

we can convert original to lower and store the returned result in word variable directly, so this could be a single line of code


Thank you for this reply, it makes more sense now. If I’m understanding correctly we could condense

word = original
word = word.lower()

into something along the lines of

word = original.lower() ?


yes. I might have lied a little. original stays intact, a copy of the string (converted to lowercase) is stored in word variable, we can see this:

original = "HELLO WORLD"
word = original.lower()
print original
print word


Thank you for the clarification!


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