It always return empty empty. I think my code is fine, though.
Eh. At a glance I’d say that code shouldn’t behave that way but I’d want to run it myself.
Reload page? Otherwise post code (and take care that it’s intact and not re-formatted by the forum or anything as every single character is important in code)
As @ionatan requested, we’d like to have your actual code so we can run it. It is much easier to work with code than with a picture, provided that the posted code is formatted.
In the meantime, it appears in the screen capture that you included a space at the beginning of the word when you entered it. That would make
original.isalpha() evaluate to
False. if you want a space between the colon and the word in the console, include the space after the colon within the prompt string.
Here is the actual code:
pyg = ‘ay’
original = raw_input(‘Enter a word:’)
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
Today, when I entered the word ‘Cookie’ without any spaces. Console gave the 'Cookie. I don’t know why, though.
That is because you have this …
Consider the previous statement, then revise the
lol I figured it out.
The translator works now. Ty very much