Help?


#1



So I'm new and trying to learn this language. I spent quite a while getting this code of mine work. If there is any suggestion that will help improve my code please do help. Thanks.


og = raw_input ('please enter a valid english word').lower()
pyg = "ay"
letter = og[0]


 
 
if len(og) >= 2 and og.isalpha():
    print (og[1:] + letter + pyg)

else:
    print "Please try again"


#2

Mine worked.
Example: pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
new_word = word + first + pyg
if len(original) > 0 and original.isalpha():
print word
print first
print new_word
else:
print 'empty'


#3

Isn't the first letter of the word suppose to be transferred at the end of the output just before pyg?

try changing this

new_word = word + first + pyg

to this

new_word = word[1:] + first + pyg

and you can delete these

print word
print first


#4

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