Ending up


#1

hi i have some problems with this program it doesnt work

pyg = 'ay'

original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
    print original

else:
    print 'empty'
word = original.lower()
first = word [0]    
new_word = word + first + pyg
new_word  [1]
new_word  [1:len(new_word)]
print new_word

Ending up PygLatin
#2

Please create new discussion and use </> icon to format your code :slight_smile:


#3

this:

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

should inside your if clause. Also, you either need to store the slice you take of new_word, or print it directly


#4

I need some help with this code, its not working!

pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word [0]
new_word [0:len(new_word)]
print new_word

if len(original) > 0 and original.isalpha():
    print original
else:
    print 'empty'

I'd appreciate any help available!


#5

look at this code:

i = 5
print i + 5 // 10
print i // 5
i = i + 5
print i // 10

lines like this:

new_word [0:len(new_word)]

don't do anything, nothing is printed or stored in a variable, you should take a slice of new_word, but from the second letter (index 1), not index 0, and you should print it or store it, and i don't understand why you didn't nest more inside the if statemetn


#6

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