Something wrong with the code


#1

I wrote the code:

pyg = 'ay'

original = raw_input('Enter a word:')

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

print new_word

But when I try deffrent input I don’t get correct output.


#2

While it does still work, it is generally not a good practice to include whitespace between the identifier and the subscript.

identifier[subscript]

Instead of printing original, print new_word.


#3

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