identifier中有顺序吗?

There are a order in identifier?

我的问题:

我有这个练习;

If the verb ends in e, drop the e and add ing (if not exception: be, see,   flee, knee, etc.)
If the verb ends in ie, change ie to y and add ing
For words consisting of consonant-vowel-consonant, double the final letter before adding ing
By default just add ing

你在本练习中的任务是定义一个函数 make_ing_form(),它给一个不定式形式的动词 returns 现在分词形式。用说谎、看、移动和拥抱等词语测试你的功能。但是,您不能期望如此简单的规则适用于所有情况。

我的代码:

def make_ing_form():
   a = raw_input("Please give a Verb: ")
   if a.endswith("ie"):
      newverb = a[:-2] + "y" + "ing"
   elif a.endswith("e"):
      newverb = a[:3] + "ing"
   elif a[1] in "aeiou":
      newverb = a + a[-1] + "ing"
   else:
      newverb = a + "ing"
   print newverb

make_ing_form()

使用此代码一切都是直觉,但是当我更改位置时;

def make_ing_form(): 
     a = raw_input("Please give a verb: ")
     if a.endswith("e"):
       newverb = a[:3] + "ing"
     elif a.endswith("ie"):
       newverb = a[:-2] + "y" + "ing"
     elif a[1] in "aeiou":
       newverb = a + a[-1] + "ing"
     else:
       newverb = a + "ing"
     print newverb

make_ing_form()

我来的答案不是现在分词,我这里是怎么理解的http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#python-has-names,当标识符变为另一个语句(从If到Elif)时,它"forget" if语句。如果是这样,为什么我会收到这个结果?

对不起我的英语....

在第二个代码中它永远不会输入第一个 elif ( elif a.endswith("ie"): ) 因为如果动词以 ie 结尾(例如 lie)它会输入 if,因为谎言以 e 结尾。您应该具有第一个代码中的条件。如果您对第一个代码有更多问题,请告诉我。