Something seams to be off, but i don't really understand why


I seam to have a problem when doing lessons... Sometimes the program gives me some errors that have nothing to do with what is going on on the screen. For example it tells me that i haven't defined something that is not on the screen at all. Gives me errors on raw_input that say "this should look like this and not like this" and gives me 2 completely different words that have nothing to do with each other and somehow connects my previous tries to each other, messes them up somehow and gives me an error.
For example at the pyg latin lessons...i want to convert the word "Bamboo" to pig latin with lower case letters - this means i have defined a variable and set it to raw_input. First try works and the word comes out at it should, hence i am happy about it. I try it a second time and the program says "the word should be /previous printout/ and not /current printout/" - by previous and current print out i mean the two different words that i had input in separate tries and the code converts them to pyg latin and prints them out.

Anyone know why this is happening?

pyg = 'ay'

s = "Charlie"

if len(s) > 0 and s.isalpha():
ss = s[0]
sl = s[1:4]
new_word = s[1:]
print new_word
print 'empty'

And what is this error about? - The value for the original variable looks off, make sure that you entered a word containing only letters. connected to the code above.


Your code looks pretty similar to mine, so I'm not sure it will work, but here we go!

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:]

print 'empty'

Hope that helped! :smile:


Oh, and I forgot to mention, remember your indentation! :smile:


What do you mean by that?
My code is exactly the same as yours at the previous chapter, but this one i do not know why it doesn't work... Anyone else?