Advertisement
rfmonk

pyg9of12.py

Nov 16th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.39 KB | None | 0 0
  1. pyg = 'ay'
  2.  
  3. original = raw_input('Enter a word:')
  4. word = original.lower()
  5. first = word[0]
  6. new_word = word + pyg
  7.  
  8. if len(original) > 0 and original.isalpha():
  9.     if first in ["a","e","i","o","u"]:
  10.         print new_word
  11.     else:
  12.         print word[1:] + first + pyg
  13. else:
  14.     print 'empty'
  15.  
  16. """ Although it seems to print correctly in the output box I receive an error message keeping me from going further with the course. (I also posted this to the course forum)
  17.  
  18. Oops, try again! Your word started with a consonant, but "dogay" was printed instead of "ogday". Make sure the correct value is stored in "new_word".
  19.  
  20. In the output window I get ogday, the desired result.
  21.  
  22. Is there anything apparent that would cause this?"""
  23.  
  24. """mokomull> rfmonk: If I had to guess, the CodeAcademy thing doesn't actually look at what you printed, and instead looks at whatever's in the new_word variable.  I would do `new_word = word[1:] + first + pyg` and `new_word = "empty"` (and replace `print new_word` with `pass`) inside the conditional, and just do "print new_word" all the way at the end, outside of the if statements.
  25.  
  26. ok so when I declared my variables I changed
  27.  
  28. new_word = word + pyg
  29. to
  30. new_word = word[1:] + first + pyg and new_word = "empty"
  31. print new_word changed to pass
  32. &
  33. print new_word outside the conditional at the end like:
  34. else:
  35.    print new_word
  36. see paste pyg9of12.2.py"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement