Optimising PygLatin


#1

Hi,

In the first lesson of pyglatin I've created this code. I know there are other ways to do this. I learned later on in the lessons that it was supposed to do otherwise.
But I was wondering, what will be the most efficient way to do this?

I've created this as example:
Instead of exit the question with empty, I'm asking again for a valid answer.
and instead of using other variables I made it into one line to print. I believe the result is the same?

word = raw_input("Please enter a word: ")
while len(word) <= 0:
    print("please try again")
    word = raw_input("Please enter a word: ")

print(word[1:]+ word[0] + "ay")

#2

The objective here is not efficiency, but proficiency which begins with following instructions. Please recognize the scope of these lessons... Introduction to basic code fundamentals. Advanced topics should not be brought into lesson topics. The majority of new learners are easily confused when we stray from the rote lesson plan.


#3

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