Hi all! I was wondering what difference it would make if I used the following code instead of the code I generated using the step-by-step approach in the lesson?
The code I wrote I did not use the string 'pyg' and 'original', and I did the lower case conversion in line 1.
Is it ok to use the code I wrote? What are the advantages or disadvantages between these two different codes?
Thank you very much for your help!
#The code I try to use word = raw_input('Enter a word:').lower() if len(word) > 0 and original.isalpha(): print word print word[1:len(word)]+word+"pyg" else: print 'empty' #Step-by-step approach pyg = 'ay' original = raw_input('Enter a word:') word=original.lower() #convert to lower case if len(original) > 0 and original.isalpha(): print original else: print 'empty' first=word new_word=word+first+pyg new_word=new_word[1:len(new_word)] print new_word