# - python - 如何將變數s傳遞給is_fl_vowel()方法？

``````
def is_fl_vowel():

if (s[0] == 'a' or s[0] == 'e' or s[0] == 'i' or s[0] == 'o' or s[0] == 'u' or s[0] == 'A' or s[0] == 'E' or s[0] == 'I' or s[0] == 'O' or s[0] == 'U') and (s[-1] == 'a' or s[-1] == 'e' or s[-1] == 'i' or s[-1] == 'o' or s[-1] == 'u' or s[-1] == 'A' or s[-1] == 'E' or s[-1] == 'I' or s[-1] == 'O' or s[-1] == 'U'):

return True

else:

return False

def main():

s = input("Enter the text to be tested")

if is_fl_vowel():

print("Passes the vowel test.")

else:

print("Fails the vowel test.")

########################################################################

### Do not modify anything below here if you want the tests to work! ###

########################################################################

if __name__ == '__main__':

main()

``````

File " python ", line 18, in File " python ", line 10, in main File " python ", line 3, in is_fl_vowel NameError : name's'is not defined

``````
def is_fl_vowel(s):

return s[0] in 'aeiou' or s[-1] in 'aeiou'

s = input("Enter the text to be tested")

if is_fl_vowel(s):

print("Passes the vowel test.")

else:

print("Fails the vowel test.")

``````