Python 如果函数在不应该执行时执行

Python 如果函数在不应该执行时执行,python,if-statement,Python,If Statement,霍德威! 我正在为学校编写一个代码,你必须编写一个程序,将用户输入转换成拉丁语。在添加所需的条件语句之前,我的代码是成功的。我的代码是: import sys while g < 10: # Start an infinite loop message = input("Enter message or type stop: ") message = message.strip() if message == 'sto

霍德威! 我正在为学校编写一个代码,你必须编写一个程序,将用户输入转换成拉丁语。在添加所需的条件语句之前,我的代码是成功的。我的代码是:

import sys
   while g < 10:  # Start an infinite loop
    
    message = input("Enter message or type stop: ")
    message = message.strip()
    
    if message == 'stop' or 'Stop':
        print('\nProgram terminated'), sys.exit()
    elif message != 'Stop' or 'stop':
        wordList = message.lower().split()
        vowels = ['a', 'e', 'i', 'o', 'u']
        Message_list = []
        eachWord = []
        for word in wordList:
            if word[0] in 'aeiou':  # case where vowel is first
                Message_list.append(word + 'yay')
            else:
                for letter in word:
                    if letter in 'aeiou':
                        Message_list.append(word[word.index(letter):] + word[:word.index(letter)] + 'ay')
                        break

但是,当我添加它时,条件始终执行。我不知道问题是什么,因为这是一个有效的条件语句。你们知道发生了什么吗?

这相当于

if (message == 'stop') or 'Stop':
工作选择包括

if message == 'stop' or message == 'Stop':

if message in ('stop', 'Stop'):

if message.upper() == "STOP":
if message == 'stop' or message == 'Stop':

if message in ('stop', 'Stop'):

if message.upper() == "STOP":